aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2016-11-01 23:16:50 -0400
committerShaohua Li <shli@fb.com>2016-11-07 18:08:22 -0500
commit1d41c216febe43150e99b24fde5eda9e8097dccc (patch)
treea06947cc82b26a58f1277fbbe62cca89fd9ea58d /drivers/md/raid1.c
parent766038846e875740cf4c20dfc5d5b292ba47360a (diff)
md/raid1: change printk() to pr_*()
Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r--drivers/md/raid1.c99
1 files changed, 41 insertions, 58 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 29e2df5cd77b..15f0b552bf48 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -347,13 +347,10 @@ static void raid1_end_read_request(struct bio *bio)
347 * oops, read error: 347 * oops, read error:
348 */ 348 */
349 char b[BDEVNAME_SIZE]; 349 char b[BDEVNAME_SIZE];
350 printk_ratelimited( 350 pr_err_ratelimited("md/raid1:%s: %s: rescheduling sector %llu\n",
351 KERN_ERR "md/raid1:%s: %s: " 351 mdname(conf->mddev),
352 "rescheduling sector %llu\n", 352 bdevname(rdev->bdev, b),
353 mdname(conf->mddev), 353 (unsigned long long)r1_bio->sector);
354 bdevname(rdev->bdev,
355 b),
356 (unsigned long long)r1_bio->sector);
357 set_bit(R1BIO_ReadError, &r1_bio->state); 354 set_bit(R1BIO_ReadError, &r1_bio->state);
358 reschedule_retry(r1_bio); 355 reschedule_retry(r1_bio);
359 /* don't drop the reference on read_disk yet */ 356 /* don't drop the reference on read_disk yet */
@@ -1461,34 +1458,33 @@ static void raid1_error(struct mddev *mddev, struct md_rdev *rdev)
1461 set_bit(MD_RECOVERY_INTR, &mddev->recovery); 1458 set_bit(MD_RECOVERY_INTR, &mddev->recovery);
1462 set_mask_bits(&mddev->flags, 0, 1459 set_mask_bits(&mddev->flags, 0,
1463 BIT(MD_CHANGE_DEVS) | BIT(MD_CHANGE_PENDING)); 1460 BIT(MD_CHANGE_DEVS) | BIT(MD_CHANGE_PENDING));
1464 printk(KERN_ALERT 1461 pr_crit("md/raid1:%s: Disk failure on %s, disabling device.\n"
1465 "md/raid1:%s: Disk failure on %s, disabling device.\n" 1462 "md/raid1:%s: Operation continuing on %d devices.\n",
1466 "md/raid1:%s: Operation continuing on %d devices.\n", 1463 mdname(mddev), bdevname(rdev->bdev, b),
1467 mdname(mddev), bdevname(rdev->bdev, b), 1464 mdname(mddev), conf->raid_disks - mddev->degraded);
1468 mdname(mddev), conf->raid_disks - mddev->degraded);
1469} 1465}
1470 1466
1471static void print_conf(struct r1conf *conf) 1467static void print_conf(struct r1conf *conf)
1472{ 1468{
1473 int i; 1469 int i;
1474 1470
1475 printk(KERN_DEBUG "RAID1 conf printout:\n"); 1471 pr_debug("RAID1 conf printout:\n");
1476 if (!conf) { 1472 if (!conf) {
1477 printk(KERN_DEBUG "(!conf)\n"); 1473 pr_debug("(!conf)\n");
1478 return; 1474 return;
1479 } 1475 }
1480 printk(KERN_DEBUG " --- wd:%d rd:%d\n", conf->raid_disks - conf->mddev->degraded, 1476 pr_debug(" --- wd:%d rd:%d\n", conf->raid_disks - conf->mddev->degraded,
1481 conf->raid_disks); 1477 conf->raid_disks);
1482 1478
1483 rcu_read_lock(); 1479 rcu_read_lock();
1484 for (i = 0; i < conf->raid_disks; i++) { 1480 for (i = 0; i < conf->raid_disks; i++) {
1485 char b[BDEVNAME_SIZE]; 1481 char b[BDEVNAME_SIZE];
1486 struct md_rdev *rdev = rcu_dereference(conf->mirrors[i].rdev); 1482 struct md_rdev *rdev = rcu_dereference(conf->mirrors[i].rdev);
1487 if (rdev) 1483 if (rdev)
1488 printk(KERN_DEBUG " disk %d, wo:%d, o:%d, dev:%s\n", 1484 pr_debug(" disk %d, wo:%d, o:%d, dev:%s\n",
1489 i, !test_bit(In_sync, &rdev->flags), 1485 i, !test_bit(In_sync, &rdev->flags),
1490 !test_bit(Faulty, &rdev->flags), 1486 !test_bit(Faulty, &rdev->flags),
1491 bdevname(rdev->bdev,b)); 1487 bdevname(rdev->bdev,b));
1492 } 1488 }
1493 rcu_read_unlock(); 1489 rcu_read_unlock();
1494} 1490}
@@ -1825,11 +1821,10 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
1825 * work just disable and interrupt the recovery. 1821 * work just disable and interrupt the recovery.
1826 * Don't fail devices as that won't really help. 1822 * Don't fail devices as that won't really help.
1827 */ 1823 */
1828 printk(KERN_ALERT "md/raid1:%s: %s: unrecoverable I/O read error" 1824 pr_crit_ratelimited("md/raid1:%s: %s: unrecoverable I/O read error for block %llu\n",
1829 " for block %llu\n", 1825 mdname(mddev),
1830 mdname(mddev), 1826 bdevname(bio->bi_bdev, b),
1831 bdevname(bio->bi_bdev, b), 1827 (unsigned long long)r1_bio->sector);
1832 (unsigned long long)r1_bio->sector);
1833 for (d = 0; d < conf->raid_disks * 2; d++) { 1828 for (d = 0; d < conf->raid_disks * 2; d++) {
1834 rdev = conf->mirrors[d].rdev; 1829 rdev = conf->mirrors[d].rdev;
1835 if (!rdev || test_bit(Faulty, &rdev->flags)) 1830 if (!rdev || test_bit(Faulty, &rdev->flags))
@@ -2122,13 +2117,11 @@ static void fix_read_error(struct r1conf *conf, int read_disk,
2122 if (r1_sync_page_io(rdev, sect, s, 2117 if (r1_sync_page_io(rdev, sect, s,
2123 conf->tmppage, READ)) { 2118 conf->tmppage, READ)) {
2124 atomic_add(s, &rdev->corrected_errors); 2119 atomic_add(s, &rdev->corrected_errors);
2125 printk(KERN_INFO 2120 pr_info("md/raid1:%s: read error corrected (%d sectors at %llu on %s)\n",
2126 "md/raid1:%s: read error corrected " 2121 mdname(mddev), s,
2127 "(%d sectors at %llu on %s)\n", 2122 (unsigned long long)(sect +
2128 mdname(mddev), s, 2123 rdev->data_offset),
2129 (unsigned long long)(sect + 2124 bdevname(rdev->bdev, b));
2130 rdev->data_offset),
2131 bdevname(rdev->bdev, b));
2132 } 2125 }
2133 rdev_dec_pending(rdev, mddev); 2126 rdev_dec_pending(rdev, mddev);
2134 } else 2127 } else
@@ -2317,9 +2310,8 @@ static void handle_read_error(struct r1conf *conf, struct r1bio *r1_bio)
2317read_more: 2310read_more:
2318 disk = read_balance(conf, r1_bio, &max_sectors); 2311 disk = read_balance(conf, r1_bio, &max_sectors);
2319 if (disk == -1) { 2312 if (disk == -1) {
2320 printk(KERN_ALERT "md/raid1:%s: %s: unrecoverable I/O" 2313 pr_crit_ratelimited("md/raid1:%s: %s: unrecoverable I/O read error for block %llu\n",
2321 " read error for block %llu\n", 2314 mdname(mddev), b, (unsigned long long)r1_bio->sector);
2322 mdname(mddev), b, (unsigned long long)r1_bio->sector);
2323 raid_end_bio_io(r1_bio); 2315 raid_end_bio_io(r1_bio);
2324 } else { 2316 } else {
2325 const unsigned long do_sync 2317 const unsigned long do_sync
@@ -2330,12 +2322,10 @@ read_more:
2330 max_sectors); 2322 max_sectors);
2331 r1_bio->bios[r1_bio->read_disk] = bio; 2323 r1_bio->bios[r1_bio->read_disk] = bio;
2332 rdev = conf->mirrors[disk].rdev; 2324 rdev = conf->mirrors[disk].rdev;
2333 printk_ratelimited(KERN_ERR 2325 pr_info_ratelimited("md/raid1:%s: redirecting sector %llu to other mirror: %s\n",
2334 "md/raid1:%s: redirecting sector %llu" 2326 mdname(mddev),
2335 " to other mirror: %s\n", 2327 (unsigned long long)r1_bio->sector,
2336 mdname(mddev), 2328 bdevname(rdev->bdev, b));
2337 (unsigned long long)r1_bio->sector,
2338 bdevname(rdev->bdev, b));
2339 bio->bi_iter.bi_sector = r1_bio->sector + rdev->data_offset; 2329 bio->bi_iter.bi_sector = r1_bio->sector + rdev->data_offset;
2340 bio->bi_bdev = rdev->bdev; 2330 bio->bi_bdev = rdev->bdev;
2341 bio->bi_end_io = raid1_end_read_request; 2331 bio->bi_end_io = raid1_end_read_request;
@@ -2875,12 +2865,8 @@ static struct r1conf *setup_conf(struct mddev *mddev)
2875 2865
2876 err = -ENOMEM; 2866 err = -ENOMEM;
2877 conf->thread = md_register_thread(raid1d, mddev, "raid1"); 2867 conf->thread = md_register_thread(raid1d, mddev, "raid1");
2878 if (!conf->thread) { 2868 if (!conf->thread)
2879 printk(KERN_ERR
2880 "md/raid1:%s: couldn't allocate thread\n",
2881 mdname(mddev));
2882 goto abort; 2869 goto abort;
2883 }
2884 2870
2885 return conf; 2871 return conf;
2886 2872
@@ -2905,13 +2891,13 @@ static int raid1_run(struct mddev *mddev)
2905 bool discard_supported = false; 2891 bool discard_supported = false;
2906 2892
2907 if (mddev->level != 1) { 2893 if (mddev->level != 1) {
2908 printk(KERN_ERR "md/raid1:%s: raid level not set to mirroring (%d)\n", 2894 pr_warn("md/raid1:%s: raid level not set to mirroring (%d)\n",
2909 mdname(mddev), mddev->level); 2895 mdname(mddev), mddev->level);
2910 return -EIO; 2896 return -EIO;
2911 } 2897 }
2912 if (mddev->reshape_position != MaxSector) { 2898 if (mddev->reshape_position != MaxSector) {
2913 printk(KERN_ERR "md/raid1:%s: reshape_position set but not supported\n", 2899 pr_warn("md/raid1:%s: reshape_position set but not supported\n",
2914 mdname(mddev)); 2900 mdname(mddev));
2915 return -EIO; 2901 return -EIO;
2916 } 2902 }
2917 /* 2903 /*
@@ -2950,11 +2936,9 @@ static int raid1_run(struct mddev *mddev)
2950 mddev->recovery_cp = MaxSector; 2936 mddev->recovery_cp = MaxSector;
2951 2937
2952 if (mddev->recovery_cp != MaxSector) 2938 if (mddev->recovery_cp != MaxSector)
2953 printk(KERN_NOTICE "md/raid1:%s: not clean" 2939 pr_info("md/raid1:%s: not clean -- starting background reconstruction\n",
2954 " -- starting background reconstruction\n", 2940 mdname(mddev));
2955 mdname(mddev)); 2941 pr_info("md/raid1:%s: active with %d out of %d mirrors\n",
2956 printk(KERN_INFO
2957 "md/raid1:%s: active with %d out of %d mirrors\n",
2958 mdname(mddev), mddev->raid_disks - mddev->degraded, 2942 mdname(mddev), mddev->raid_disks - mddev->degraded,
2959 mddev->raid_disks); 2943 mddev->raid_disks);
2960 2944
@@ -3107,9 +3091,8 @@ static int raid1_reshape(struct mddev *mddev)
3107 rdev->raid_disk = d2; 3091 rdev->raid_disk = d2;
3108 sysfs_unlink_rdev(mddev, rdev); 3092 sysfs_unlink_rdev(mddev, rdev);
3109 if (sysfs_link_rdev(mddev, rdev)) 3093 if (sysfs_link_rdev(mddev, rdev))
3110 printk(KERN_WARNING 3094 pr_warn("md/raid1:%s: cannot register rd%d\n",
3111 "md/raid1:%s: cannot register rd%d\n", 3095 mdname(mddev), rdev->raid_disk);
3112 mdname(mddev), rdev->raid_disk);
3113 } 3096 }
3114 if (rdev) 3097 if (rdev)
3115 newmirrors[d2++].rdev = rdev; 3098 newmirrors[d2++].rdev = rdev;