aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-10-06 23:23:17 -0400
committerNeilBrown <neilb@suse.de>2011-10-06 23:23:17 -0400
commit36a4e1fe0f454146724c174bf7c1e8e76297a212 (patch)
tree57f0de83fda98e5ae1b4f66d5e993ca27386a793 /drivers
parentbdc04e6b15f70a8f96d8cdfe21df159a6466b49a (diff)
md: remove PRINTK and dprintk debugging and use pr_debug
Being able to dynamically enable these make them much more useful. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/bitmap.c33
-rw-r--r--drivers/md/md.c28
-rw-r--r--drivers/md/raid1.c24
3 files changed, 35 insertions, 50 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 689623c3cffa..cd722b83a0c9 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -50,14 +50,6 @@
50#define INJECT_FATAL_FAULT_3 0 /* undef */ 50#define INJECT_FATAL_FAULT_3 0 /* undef */
51#endif 51#endif
52 52
53#ifndef PRINTK
54# if DEBUG > 0
55# define PRINTK(x...) printk(KERN_DEBUG x)
56# else
57# define PRINTK(x...)
58# endif
59#endif
60
61static inline char *bmname(struct bitmap *bitmap) 53static inline char *bmname(struct bitmap *bitmap)
62{ 54{
63 return bitmap->mddev ? mdname(bitmap->mddev) : "mdX"; 55 return bitmap->mddev ? mdname(bitmap->mddev) : "mdX";
@@ -78,8 +70,8 @@ static unsigned char *bitmap_alloc_page(struct bitmap *bitmap)
78 if (!page) 70 if (!page)
79 printk("%s: bitmap_alloc_page FAILED\n", bmname(bitmap)); 71 printk("%s: bitmap_alloc_page FAILED\n", bmname(bitmap));
80 else 72 else
81 PRINTK("%s: bitmap_alloc_page: allocated page at %p\n", 73 pr_debug("%s: bitmap_alloc_page: allocated page at %p\n",
82 bmname(bitmap), page); 74 bmname(bitmap), page);
83 return page; 75 return page;
84} 76}
85 77
@@ -88,7 +80,7 @@ static unsigned char *bitmap_alloc_page(struct bitmap *bitmap)
88 */ 80 */
89static void bitmap_free_page(struct bitmap *bitmap, unsigned char *page) 81static void bitmap_free_page(struct bitmap *bitmap, unsigned char *page)
90{ 82{
91 PRINTK("%s: bitmap_free_page: free page %p\n", bmname(bitmap), page); 83 pr_debug("%s: bitmap_free_page: free page %p\n", bmname(bitmap), page);
92 kfree(page); 84 kfree(page);
93} 85}
94 86
@@ -133,8 +125,8 @@ __acquires(bitmap->lock)
133 spin_lock_irq(&bitmap->lock); 125 spin_lock_irq(&bitmap->lock);
134 126
135 if (mappage == NULL) { 127 if (mappage == NULL) {
136 PRINTK("%s: bitmap map page allocation failed, hijacking\n", 128 pr_debug("%s: bitmap map page allocation failed, hijacking\n",
137 bmname(bitmap)); 129 bmname(bitmap));
138 /* failed - set the hijacked flag so that we can use the 130 /* failed - set the hijacked flag so that we can use the
139 * pointer as a counter */ 131 * pointer as a counter */
140 if (!bitmap->bp[page].map) 132 if (!bitmap->bp[page].map)
@@ -409,8 +401,8 @@ static struct page *read_page(struct file *file, unsigned long index,
409 struct buffer_head *bh; 401 struct buffer_head *bh;
410 sector_t block; 402 sector_t block;
411 403
412 PRINTK("read bitmap file (%dB @ %llu)\n", (int)PAGE_SIZE, 404 pr_debug("read bitmap file (%dB @ %llu)\n", (int)PAGE_SIZE,
413 (unsigned long long)index << PAGE_SHIFT); 405 (unsigned long long)index << PAGE_SHIFT);
414 406
415 page = alloc_page(GFP_KERNEL); 407 page = alloc_page(GFP_KERNEL);
416 if (!page) 408 if (!page)
@@ -920,7 +912,7 @@ static void bitmap_file_set_bit(struct bitmap *bitmap, sector_t block)
920 else 912 else
921 __set_bit_le(bit, kaddr); 913 __set_bit_le(bit, kaddr);
922 kunmap_atomic(kaddr, KM_USER0); 914 kunmap_atomic(kaddr, KM_USER0);
923 PRINTK("set file bit %lu page %lu\n", bit, page->index); 915 pr_debug("set file bit %lu page %lu\n", bit, page->index);
924 /* record page number so it gets flushed to disk when unplug occurs */ 916 /* record page number so it gets flushed to disk when unplug occurs */
925 set_page_attr(bitmap, page, BITMAP_PAGE_DIRTY); 917 set_page_attr(bitmap, page, BITMAP_PAGE_DIRTY);
926} 918}
@@ -1364,8 +1356,8 @@ int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sect
1364 if (bw > bitmap->behind_writes_used) 1356 if (bw > bitmap->behind_writes_used)
1365 bitmap->behind_writes_used = bw; 1357 bitmap->behind_writes_used = bw;
1366 1358
1367 PRINTK(KERN_DEBUG "inc write-behind count %d/%d\n", 1359 pr_debug("inc write-behind count %d/%lu\n",
1368 bw, bitmap->max_write_behind); 1360 bw, bitmap->mddev->bitmap_info.max_write_behind);
1369 } 1361 }
1370 1362
1371 while (sectors) { 1363 while (sectors) {
@@ -1424,8 +1416,9 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long secto
1424 if (behind) { 1416 if (behind) {
1425 if (atomic_dec_and_test(&bitmap->behind_writes)) 1417 if (atomic_dec_and_test(&bitmap->behind_writes))
1426 wake_up(&bitmap->behind_wait); 1418 wake_up(&bitmap->behind_wait);
1427 PRINTK(KERN_DEBUG "dec write-behind count %d/%d\n", 1419 pr_debug("dec write-behind count %d/%lu\n",
1428 atomic_read(&bitmap->behind_writes), bitmap->max_write_behind); 1420 atomic_read(&bitmap->behind_writes),
1421 bitmap->mddev->bitmap_info.max_write_behind);
1429 } 1422 }
1430 if (bitmap->mddev->degraded) 1423 if (bitmap->mddev->degraded)
1431 /* Never clear bits or update events_cleared when degraded */ 1424 /* Never clear bits or update events_cleared when degraded */
diff --git a/drivers/md/md.c b/drivers/md/md.c
index accae4422c06..ca4c283cf462 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -54,9 +54,6 @@
54#include "md.h" 54#include "md.h"
55#include "bitmap.h" 55#include "bitmap.h"
56 56
57#define DEBUG 0
58#define dprintk(x...) ((void)(DEBUG && printk(x)))
59
60#ifndef MODULE 57#ifndef MODULE
61static void autostart_arrays(int part); 58static void autostart_arrays(int part);
62#endif 59#endif
@@ -2442,27 +2439,23 @@ repeat:
2442 sync_sbs(mddev, nospares); 2439 sync_sbs(mddev, nospares);
2443 spin_unlock_irq(&mddev->write_lock); 2440 spin_unlock_irq(&mddev->write_lock);
2444 2441
2445 dprintk(KERN_INFO 2442 pr_debug("md: updating %s RAID superblock on device (in sync %d)\n",
2446 "md: updating %s RAID superblock on device (in sync %d)\n", 2443 mdname(mddev), mddev->in_sync);
2447 mdname(mddev),mddev->in_sync);
2448 2444
2449 bitmap_update_sb(mddev->bitmap); 2445 bitmap_update_sb(mddev->bitmap);
2450 list_for_each_entry(rdev, &mddev->disks, same_set) { 2446 list_for_each_entry(rdev, &mddev->disks, same_set) {
2451 char b[BDEVNAME_SIZE]; 2447 char b[BDEVNAME_SIZE];
2452 dprintk(KERN_INFO "md: "); 2448
2453 if (rdev->sb_loaded != 1) 2449 if (rdev->sb_loaded != 1)
2454 continue; /* no noise on spare devices */ 2450 continue; /* no noise on spare devices */
2455 if (test_bit(Faulty, &rdev->flags))
2456 dprintk("(skipping faulty ");
2457 2451
2458 dprintk("%s ", bdevname(rdev->bdev,b));
2459 if (!test_bit(Faulty, &rdev->flags)) { 2452 if (!test_bit(Faulty, &rdev->flags)) {
2460 md_super_write(mddev,rdev, 2453 md_super_write(mddev,rdev,
2461 rdev->sb_start, rdev->sb_size, 2454 rdev->sb_start, rdev->sb_size,
2462 rdev->sb_page); 2455 rdev->sb_page);
2463 dprintk(KERN_INFO "(write) %s's sb offset: %llu\n", 2456 pr_debug("md: (write) %s's sb offset: %llu\n",
2464 bdevname(rdev->bdev,b), 2457 bdevname(rdev->bdev, b),
2465 (unsigned long long)rdev->sb_start); 2458 (unsigned long long)rdev->sb_start);
2466 rdev->sb_events = mddev->events; 2459 rdev->sb_events = mddev->events;
2467 if (rdev->badblocks.size) { 2460 if (rdev->badblocks.size) {
2468 md_super_write(mddev, rdev, 2461 md_super_write(mddev, rdev,
@@ -2473,7 +2466,8 @@ repeat:
2473 } 2466 }
2474 2467
2475 } else 2468 } else
2476 dprintk(")\n"); 2469 pr_debug("md: %s (skipping faulty)\n",
2470 bdevname(rdev->bdev, b));
2477 if (mddev->level == LEVEL_MULTIPATH) 2471 if (mddev->level == LEVEL_MULTIPATH)
2478 /* only need to write one superblock... */ 2472 /* only need to write one superblock... */
2479 break; 2473 break;
@@ -6408,7 +6402,7 @@ static int md_thread(void * arg)
6408void md_wakeup_thread(mdk_thread_t *thread) 6402void md_wakeup_thread(mdk_thread_t *thread)
6409{ 6403{
6410 if (thread) { 6404 if (thread) {
6411 dprintk("md: waking up MD thread %s.\n", thread->tsk->comm); 6405 pr_debug("md: waking up MD thread %s.\n", thread->tsk->comm);
6412 set_bit(THREAD_WAKEUP, &thread->flags); 6406 set_bit(THREAD_WAKEUP, &thread->flags);
6413 wake_up(&thread->wqueue); 6407 wake_up(&thread->wqueue);
6414 } 6408 }
@@ -6444,7 +6438,7 @@ void md_unregister_thread(mdk_thread_t **threadp)
6444 mdk_thread_t *thread = *threadp; 6438 mdk_thread_t *thread = *threadp;
6445 if (!thread) 6439 if (!thread)
6446 return; 6440 return;
6447 dprintk("interrupting MD-thread pid %d\n", task_pid_nr(thread->tsk)); 6441 pr_debug("interrupting MD-thread pid %d\n", task_pid_nr(thread->tsk));
6448 /* Locking ensures that mddev_unlock does not wake_up a 6442 /* Locking ensures that mddev_unlock does not wake_up a
6449 * non-existent thread 6443 * non-existent thread
6450 */ 6444 */
@@ -8112,7 +8106,7 @@ static struct notifier_block md_notifier = {
8112 8106
8113static void md_geninit(void) 8107static void md_geninit(void)
8114{ 8108{
8115 dprintk("md: sizeof(mdp_super_t) = %d\n", (int)sizeof(mdp_super_t)); 8109 pr_debug("md: sizeof(mdp_super_t) = %d\n", (int)sizeof(mdp_super_t));
8116 8110
8117 proc_create("mdstat", S_IRUGO, NULL, &md_seq_fops); 8111 proc_create("mdstat", S_IRUGO, NULL, &md_seq_fops);
8118} 8112}
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 77fab07abcee..c8993fb8286c 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -40,9 +40,6 @@
40#include "raid1.h" 40#include "raid1.h"
41#include "bitmap.h" 41#include "bitmap.h"
42 42
43#define DEBUG 0
44#define PRINTK(x...) do { if (DEBUG) printk(x); } while (0)
45
46/* 43/*
47 * Number of guaranteed r1bios in case of extreme VM load: 44 * Number of guaranteed r1bios in case of extreme VM load:
48 */ 45 */
@@ -246,11 +243,11 @@ static void raid_end_bio_io(r1bio_t *r1_bio)
246 243
247 /* if nobody has done the final endio yet, do it now */ 244 /* if nobody has done the final endio yet, do it now */
248 if (!test_and_set_bit(R1BIO_Returned, &r1_bio->state)) { 245 if (!test_and_set_bit(R1BIO_Returned, &r1_bio->state)) {
249 PRINTK(KERN_DEBUG "raid1: sync end %s on sectors %llu-%llu\n", 246 pr_debug("raid1: sync end %s on sectors %llu-%llu\n",
250 (bio_data_dir(bio) == WRITE) ? "write" : "read", 247 (bio_data_dir(bio) == WRITE) ? "write" : "read",
251 (unsigned long long) bio->bi_sector, 248 (unsigned long long) bio->bi_sector,
252 (unsigned long long) bio->bi_sector + 249 (unsigned long long) bio->bi_sector +
253 (bio->bi_size >> 9) - 1); 250 (bio->bi_size >> 9) - 1);
254 251
255 call_bio_endio(r1_bio); 252 call_bio_endio(r1_bio);
256 } 253 }
@@ -431,10 +428,11 @@ static void raid1_end_write_request(struct bio *bio, int error)
431 /* Maybe we can return now */ 428 /* Maybe we can return now */
432 if (!test_and_set_bit(R1BIO_Returned, &r1_bio->state)) { 429 if (!test_and_set_bit(R1BIO_Returned, &r1_bio->state)) {
433 struct bio *mbio = r1_bio->master_bio; 430 struct bio *mbio = r1_bio->master_bio;
434 PRINTK(KERN_DEBUG "raid1: behind end write sectors %llu-%llu\n", 431 pr_debug("raid1: behind end write sectors"
435 (unsigned long long) mbio->bi_sector, 432 " %llu-%llu\n",
436 (unsigned long long) mbio->bi_sector + 433 (unsigned long long) mbio->bi_sector,
437 (mbio->bi_size >> 9) - 1); 434 (unsigned long long) mbio->bi_sector +
435 (mbio->bi_size >> 9) - 1);
438 call_bio_endio(r1_bio); 436 call_bio_endio(r1_bio);
439 } 437 }
440 } 438 }
@@ -795,7 +793,7 @@ do_sync_io:
795 if (bvecs[i].bv_page) 793 if (bvecs[i].bv_page)
796 put_page(bvecs[i].bv_page); 794 put_page(bvecs[i].bv_page);
797 kfree(bvecs); 795 kfree(bvecs);
798 PRINTK("%dB behind alloc failed, doing sync I/O\n", bio->bi_size); 796 pr_debug("%dB behind alloc failed, doing sync I/O\n", bio->bi_size);
799} 797}
800 798
801static int make_request(mddev_t *mddev, struct bio * bio) 799static int make_request(mddev_t *mddev, struct bio * bio)