Commit 36a4e1fe authored by NeilBrown's avatar NeilBrown

md: remove PRINTK and dprintk debugging and use pr_debug

Being able to dynamically enable these make them much more useful.
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent bdc04e6b
...@@ -50,14 +50,6 @@ ...@@ -50,14 +50,6 @@
#define INJECT_FATAL_FAULT_3 0 /* undef */ #define INJECT_FATAL_FAULT_3 0 /* undef */
#endif #endif
#ifndef PRINTK
# if DEBUG > 0
# define PRINTK(x...) printk(KERN_DEBUG x)
# else
# define PRINTK(x...)
# endif
#endif
static inline char *bmname(struct bitmap *bitmap) static inline char *bmname(struct bitmap *bitmap)
{ {
return bitmap->mddev ? mdname(bitmap->mddev) : "mdX"; return bitmap->mddev ? mdname(bitmap->mddev) : "mdX";
...@@ -78,8 +70,8 @@ static unsigned char *bitmap_alloc_page(struct bitmap *bitmap) ...@@ -78,8 +70,8 @@ static unsigned char *bitmap_alloc_page(struct bitmap *bitmap)
if (!page) if (!page)
printk("%s: bitmap_alloc_page FAILED\n", bmname(bitmap)); printk("%s: bitmap_alloc_page FAILED\n", bmname(bitmap));
else else
PRINTK("%s: bitmap_alloc_page: allocated page at %p\n", pr_debug("%s: bitmap_alloc_page: allocated page at %p\n",
bmname(bitmap), page); bmname(bitmap), page);
return page; return page;
} }
...@@ -88,7 +80,7 @@ static unsigned char *bitmap_alloc_page(struct bitmap *bitmap) ...@@ -88,7 +80,7 @@ static unsigned char *bitmap_alloc_page(struct bitmap *bitmap)
*/ */
static void bitmap_free_page(struct bitmap *bitmap, unsigned char *page) static void bitmap_free_page(struct bitmap *bitmap, unsigned char *page)
{ {
PRINTK("%s: bitmap_free_page: free page %p\n", bmname(bitmap), page); pr_debug("%s: bitmap_free_page: free page %p\n", bmname(bitmap), page);
kfree(page); kfree(page);
} }
...@@ -133,8 +125,8 @@ __acquires(bitmap->lock) ...@@ -133,8 +125,8 @@ __acquires(bitmap->lock)
spin_lock_irq(&bitmap->lock); spin_lock_irq(&bitmap->lock);
if (mappage == NULL) { if (mappage == NULL) {
PRINTK("%s: bitmap map page allocation failed, hijacking\n", pr_debug("%s: bitmap map page allocation failed, hijacking\n",
bmname(bitmap)); bmname(bitmap));
/* failed - set the hijacked flag so that we can use the /* failed - set the hijacked flag so that we can use the
* pointer as a counter */ * pointer as a counter */
if (!bitmap->bp[page].map) if (!bitmap->bp[page].map)
...@@ -409,8 +401,8 @@ static struct page *read_page(struct file *file, unsigned long index, ...@@ -409,8 +401,8 @@ static struct page *read_page(struct file *file, unsigned long index,
struct buffer_head *bh; struct buffer_head *bh;
sector_t block; sector_t block;
PRINTK("read bitmap file (%dB @ %llu)\n", (int)PAGE_SIZE, pr_debug("read bitmap file (%dB @ %llu)\n", (int)PAGE_SIZE,
(unsigned long long)index << PAGE_SHIFT); (unsigned long long)index << PAGE_SHIFT);
page = alloc_page(GFP_KERNEL); page = alloc_page(GFP_KERNEL);
if (!page) if (!page)
...@@ -920,7 +912,7 @@ static void bitmap_file_set_bit(struct bitmap *bitmap, sector_t block) ...@@ -920,7 +912,7 @@ static void bitmap_file_set_bit(struct bitmap *bitmap, sector_t block)
else else
__set_bit_le(bit, kaddr); __set_bit_le(bit, kaddr);
kunmap_atomic(kaddr, KM_USER0); kunmap_atomic(kaddr, KM_USER0);
PRINTK("set file bit %lu page %lu\n", bit, page->index); pr_debug("set file bit %lu page %lu\n", bit, page->index);
/* record page number so it gets flushed to disk when unplug occurs */ /* record page number so it gets flushed to disk when unplug occurs */
set_page_attr(bitmap, page, BITMAP_PAGE_DIRTY); set_page_attr(bitmap, page, BITMAP_PAGE_DIRTY);
} }
...@@ -1364,8 +1356,8 @@ int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sect ...@@ -1364,8 +1356,8 @@ int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sect
if (bw > bitmap->behind_writes_used) if (bw > bitmap->behind_writes_used)
bitmap->behind_writes_used = bw; bitmap->behind_writes_used = bw;
PRINTK(KERN_DEBUG "inc write-behind count %d/%d\n", pr_debug("inc write-behind count %d/%lu\n",
bw, bitmap->max_write_behind); bw, bitmap->mddev->bitmap_info.max_write_behind);
} }
while (sectors) { while (sectors) {
...@@ -1424,8 +1416,9 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long secto ...@@ -1424,8 +1416,9 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long secto
if (behind) { if (behind) {
if (atomic_dec_and_test(&bitmap->behind_writes)) if (atomic_dec_and_test(&bitmap->behind_writes))
wake_up(&bitmap->behind_wait); wake_up(&bitmap->behind_wait);
PRINTK(KERN_DEBUG "dec write-behind count %d/%d\n", pr_debug("dec write-behind count %d/%lu\n",
atomic_read(&bitmap->behind_writes), bitmap->max_write_behind); atomic_read(&bitmap->behind_writes),
bitmap->mddev->bitmap_info.max_write_behind);
} }
if (bitmap->mddev->degraded) if (bitmap->mddev->degraded)
/* Never clear bits or update events_cleared when degraded */ /* Never clear bits or update events_cleared when degraded */
......
...@@ -54,9 +54,6 @@ ...@@ -54,9 +54,6 @@
#include "md.h" #include "md.h"
#include "bitmap.h" #include "bitmap.h"
#define DEBUG 0
#define dprintk(x...) ((void)(DEBUG && printk(x)))
#ifndef MODULE #ifndef MODULE
static void autostart_arrays(int part); static void autostart_arrays(int part);
#endif #endif
...@@ -2442,27 +2439,23 @@ static void md_update_sb(mddev_t * mddev, int force_change) ...@@ -2442,27 +2439,23 @@ static void md_update_sb(mddev_t * mddev, int force_change)
sync_sbs(mddev, nospares); sync_sbs(mddev, nospares);
spin_unlock_irq(&mddev->write_lock); spin_unlock_irq(&mddev->write_lock);
dprintk(KERN_INFO pr_debug("md: updating %s RAID superblock on device (in sync %d)\n",
"md: updating %s RAID superblock on device (in sync %d)\n", mdname(mddev), mddev->in_sync);
mdname(mddev),mddev->in_sync);
bitmap_update_sb(mddev->bitmap); bitmap_update_sb(mddev->bitmap);
list_for_each_entry(rdev, &mddev->disks, same_set) { list_for_each_entry(rdev, &mddev->disks, same_set) {
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
dprintk(KERN_INFO "md: ");
if (rdev->sb_loaded != 1) if (rdev->sb_loaded != 1)
continue; /* no noise on spare devices */ continue; /* no noise on spare devices */
if (test_bit(Faulty, &rdev->flags))
dprintk("(skipping faulty ");
dprintk("%s ", bdevname(rdev->bdev,b));
if (!test_bit(Faulty, &rdev->flags)) { if (!test_bit(Faulty, &rdev->flags)) {
md_super_write(mddev,rdev, md_super_write(mddev,rdev,
rdev->sb_start, rdev->sb_size, rdev->sb_start, rdev->sb_size,
rdev->sb_page); rdev->sb_page);
dprintk(KERN_INFO "(write) %s's sb offset: %llu\n", pr_debug("md: (write) %s's sb offset: %llu\n",
bdevname(rdev->bdev,b), bdevname(rdev->bdev, b),
(unsigned long long)rdev->sb_start); (unsigned long long)rdev->sb_start);
rdev->sb_events = mddev->events; rdev->sb_events = mddev->events;
if (rdev->badblocks.size) { if (rdev->badblocks.size) {
md_super_write(mddev, rdev, md_super_write(mddev, rdev,
...@@ -2473,7 +2466,8 @@ static void md_update_sb(mddev_t * mddev, int force_change) ...@@ -2473,7 +2466,8 @@ static void md_update_sb(mddev_t * mddev, int force_change)
} }
} else } else
dprintk(")\n"); pr_debug("md: %s (skipping faulty)\n",
bdevname(rdev->bdev, b));
if (mddev->level == LEVEL_MULTIPATH) if (mddev->level == LEVEL_MULTIPATH)
/* only need to write one superblock... */ /* only need to write one superblock... */
break; break;
...@@ -6408,7 +6402,7 @@ static int md_thread(void * arg) ...@@ -6408,7 +6402,7 @@ static int md_thread(void * arg)
void md_wakeup_thread(mdk_thread_t *thread) void md_wakeup_thread(mdk_thread_t *thread)
{ {
if (thread) { if (thread) {
dprintk("md: waking up MD thread %s.\n", thread->tsk->comm); pr_debug("md: waking up MD thread %s.\n", thread->tsk->comm);
set_bit(THREAD_WAKEUP, &thread->flags); set_bit(THREAD_WAKEUP, &thread->flags);
wake_up(&thread->wqueue); wake_up(&thread->wqueue);
} }
...@@ -6444,7 +6438,7 @@ void md_unregister_thread(mdk_thread_t **threadp) ...@@ -6444,7 +6438,7 @@ void md_unregister_thread(mdk_thread_t **threadp)
mdk_thread_t *thread = *threadp; mdk_thread_t *thread = *threadp;
if (!thread) if (!thread)
return; return;
dprintk("interrupting MD-thread pid %d\n", task_pid_nr(thread->tsk)); pr_debug("interrupting MD-thread pid %d\n", task_pid_nr(thread->tsk));
/* Locking ensures that mddev_unlock does not wake_up a /* Locking ensures that mddev_unlock does not wake_up a
* non-existent thread * non-existent thread
*/ */
...@@ -8112,7 +8106,7 @@ static struct notifier_block md_notifier = { ...@@ -8112,7 +8106,7 @@ static struct notifier_block md_notifier = {
static void md_geninit(void) static void md_geninit(void)
{ {
dprintk("md: sizeof(mdp_super_t) = %d\n", (int)sizeof(mdp_super_t)); pr_debug("md: sizeof(mdp_super_t) = %d\n", (int)sizeof(mdp_super_t));
proc_create("mdstat", S_IRUGO, NULL, &md_seq_fops); proc_create("mdstat", S_IRUGO, NULL, &md_seq_fops);
} }
......
...@@ -40,9 +40,6 @@ ...@@ -40,9 +40,6 @@
#include "raid1.h" #include "raid1.h"
#include "bitmap.h" #include "bitmap.h"
#define DEBUG 0
#define PRINTK(x...) do { if (DEBUG) printk(x); } while (0)
/* /*
* Number of guaranteed r1bios in case of extreme VM load: * Number of guaranteed r1bios in case of extreme VM load:
*/ */
...@@ -246,11 +243,11 @@ static void raid_end_bio_io(r1bio_t *r1_bio) ...@@ -246,11 +243,11 @@ static void raid_end_bio_io(r1bio_t *r1_bio)
/* if nobody has done the final endio yet, do it now */ /* if nobody has done the final endio yet, do it now */
if (!test_and_set_bit(R1BIO_Returned, &r1_bio->state)) { if (!test_and_set_bit(R1BIO_Returned, &r1_bio->state)) {
PRINTK(KERN_DEBUG "raid1: sync end %s on sectors %llu-%llu\n", pr_debug("raid1: sync end %s on sectors %llu-%llu\n",
(bio_data_dir(bio) == WRITE) ? "write" : "read", (bio_data_dir(bio) == WRITE) ? "write" : "read",
(unsigned long long) bio->bi_sector, (unsigned long long) bio->bi_sector,
(unsigned long long) bio->bi_sector + (unsigned long long) bio->bi_sector +
(bio->bi_size >> 9) - 1); (bio->bi_size >> 9) - 1);
call_bio_endio(r1_bio); call_bio_endio(r1_bio);
} }
...@@ -431,10 +428,11 @@ static void raid1_end_write_request(struct bio *bio, int error) ...@@ -431,10 +428,11 @@ static void raid1_end_write_request(struct bio *bio, int error)
/* Maybe we can return now */ /* Maybe we can return now */
if (!test_and_set_bit(R1BIO_Returned, &r1_bio->state)) { if (!test_and_set_bit(R1BIO_Returned, &r1_bio->state)) {
struct bio *mbio = r1_bio->master_bio; struct bio *mbio = r1_bio->master_bio;
PRINTK(KERN_DEBUG "raid1: behind end write sectors %llu-%llu\n", pr_debug("raid1: behind end write sectors"
(unsigned long long) mbio->bi_sector, " %llu-%llu\n",
(unsigned long long) mbio->bi_sector + (unsigned long long) mbio->bi_sector,
(mbio->bi_size >> 9) - 1); (unsigned long long) mbio->bi_sector +
(mbio->bi_size >> 9) - 1);
call_bio_endio(r1_bio); call_bio_endio(r1_bio);
} }
} }
...@@ -795,7 +793,7 @@ static void alloc_behind_pages(struct bio *bio, r1bio_t *r1_bio) ...@@ -795,7 +793,7 @@ static void alloc_behind_pages(struct bio *bio, r1bio_t *r1_bio)
if (bvecs[i].bv_page) if (bvecs[i].bv_page)
put_page(bvecs[i].bv_page); put_page(bvecs[i].bv_page);
kfree(bvecs); kfree(bvecs);
PRINTK("%dB behind alloc failed, doing sync I/O\n", bio->bi_size); pr_debug("%dB behind alloc failed, doing sync I/O\n", bio->bi_size);
} }
static int make_request(mddev_t *mddev, struct bio * bio) static int make_request(mddev_t *mddev, struct bio * bio)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment