diff options
author | Christoph Hellwig <hch@lst.de> | 2022-05-12 08:19:13 +0200 |
---|---|---|
committer | Song Liu <song@kernel.org> | 2022-05-22 23:07:21 -0700 |
commit | 913cce5a1e588e3470ea064fe4ea336037d3a454 (patch) | |
tree | d5335aef357429a908652048eb5c83292640a612 /drivers/md/raid10.c | |
parent | 1e267742283a4b5a8ca65755c44166be27e9aa0f (diff) | |
download | linux-stable-913cce5a1e588e3470ea064fe4ea336037d3a454.tar.gz linux-stable-913cce5a1e588e3470ea064fe4ea336037d3a454.tar.bz2 linux-stable-913cce5a1e588e3470ea064fe4ea336037d3a454.zip |
md: remove most calls to bdevname
Use the %pg format specifier to save on stack consumption and code size.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Song Liu <song@kernel.org>
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r-- | drivers/md/raid10.c | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index dfa576cdf11c..d589f823feb1 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -397,10 +397,9 @@ static void raid10_end_read_request(struct bio *bio) /* * oops, read error - keep the refcount on the rdev */ - char b[BDEVNAME_SIZE]; - pr_err_ratelimited("md/raid10:%s: %s: rescheduling sector %llu\n", + pr_err_ratelimited("md/raid10:%s: %pg: rescheduling sector %llu\n", mdname(conf->mddev), - bdevname(rdev->bdev, b), + rdev->bdev, (unsigned long long)r10_bio->sector); set_bit(R10BIO_ReadError, &r10_bio->state); reschedule_retry(r10_bio); @@ -1187,9 +1186,9 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio, return; } if (err_rdev) - pr_err_ratelimited("md/raid10:%s: %s: redirecting sector %llu to another mirror\n", + pr_err_ratelimited("md/raid10:%s: %pg: redirecting sector %llu to another mirror\n", mdname(mddev), - bdevname(rdev->bdev, b), + rdev->bdev, (unsigned long long)r10_bio->sector); if (max_sectors < bio_sectors(bio)) { struct bio *split = bio_split(bio, max_sectors, @@ -1987,7 +1986,6 @@ static int enough(struct r10conf *conf, int ignore) */ static void raid10_error(struct mddev *mddev, struct md_rdev *rdev) { - char b[BDEVNAME_SIZE]; struct r10conf *conf = mddev->private; unsigned long flags; @@ -2010,9 +2008,9 @@ static void raid10_error(struct mddev *mddev, struct md_rdev *rdev) set_mask_bits(&mddev->sb_flags, 0, BIT(MD_SB_CHANGE_DEVS) | BIT(MD_SB_CHANGE_PENDING)); spin_unlock_irqrestore(&conf->device_lock, flags); - pr_crit("md/raid10:%s: Disk failure on %s, disabling device.\n" + pr_crit("md/raid10:%s: Disk failure on %pg, disabling device.\n" "md/raid10:%s: Operation continuing on %d devices.\n", - mdname(mddev), bdevname(rdev->bdev, b), + mdname(mddev), rdev->bdev, mdname(mddev), conf->geo.raid_disks - mddev->degraded); } @@ -2032,13 +2030,12 @@ static void print_conf(struct r10conf *conf) /* This is only called with ->reconfix_mutex held, so * rcu protection of rdev is not needed */ for (i = 0; i < conf->geo.raid_disks; i++) { - char b[BDEVNAME_SIZE]; rdev = conf->mirrors[i].rdev; if (rdev) - pr_debug(" disk %d, wo:%d, o:%d, dev:%s\n", + pr_debug(" disk %d, wo:%d, o:%d, dev:%pg\n", i, !test_bit(In_sync, &rdev->flags), !test_bit(Faulty, &rdev->flags), - bdevname(rdev->bdev,b)); + rdev->bdev); } } @@ -2691,14 +2688,11 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10 check_decay_read_errors(mddev, rdev); atomic_inc(&rdev->read_errors); if (atomic_read(&rdev->read_errors) > max_read_errors) { - char b[BDEVNAME_SIZE]; - bdevname(rdev->bdev, b); - - pr_notice("md/raid10:%s: %s: Raid device exceeded read_error threshold [cur %d:max %d]\n", - mdname(mddev), b, + pr_notice("md/raid10:%s: %pg: Raid device exceeded read_error threshold [cur %d:max %d]\n", + mdname(mddev), rdev->bdev, atomic_read(&rdev->read_errors), max_read_errors); - pr_notice("md/raid10:%s: %s: Failing raid device\n", - mdname(mddev), b); + pr_notice("md/raid10:%s: %pg: Failing raid device\n", + mdname(mddev), rdev->bdev); md_error(mddev, rdev); r10_bio->devs[r10_bio->read_slot].bio = IO_BLOCKED; return; @@ -2768,8 +2762,6 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10 /* write it back and re-read */ rcu_read_lock(); while (sl != r10_bio->read_slot) { - char b[BDEVNAME_SIZE]; - if (sl==0) sl = conf->copies; sl--; @@ -2788,24 +2780,22 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10 s, conf->tmppage, WRITE) == 0) { /* Well, this device is dead */ - pr_notice("md/raid10:%s: read correction write failed (%d sectors at %llu on %s)\n", + pr_notice("md/raid10:%s: read correction write failed (%d sectors at %llu on %pg)\n", mdname(mddev), s, (unsigned long long)( sect + choose_data_offset(r10_bio, rdev)), - bdevname(rdev->bdev, b)); - pr_notice("md/raid10:%s: %s: failing drive\n", + rdev->bdev); + pr_notice("md/raid10:%s: %pg: failing drive\n", mdname(mddev), - bdevname(rdev->bdev, b)); + rdev->bdev); } rdev_dec_pending(rdev, mddev); rcu_read_lock(); } sl = start; while (sl != r10_bio->read_slot) { - char b[BDEVNAME_SIZE]; - if (sl==0) sl = conf->copies; sl--; @@ -2825,23 +2815,23 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10 READ)) { case 0: /* Well, this device is dead */ - pr_notice("md/raid10:%s: unable to read back corrected sectors (%d sectors at %llu on %s)\n", + pr_notice("md/raid10:%s: unable to read back corrected sectors (%d sectors at %llu on %pg)\n", mdname(mddev), s, (unsigned long long)( sect + choose_data_offset(r10_bio, rdev)), - bdevname(rdev->bdev, b)); - pr_notice("md/raid10:%s: %s: failing drive\n", + rdev->bdev); + pr_notice("md/raid10:%s: %pg: failing drive\n", mdname(mddev), - bdevname(rdev->bdev, b)); + rdev->bdev); break; case 1: - pr_info("md/raid10:%s: read error corrected (%d sectors at %llu on %s)\n", + pr_info("md/raid10:%s: read error corrected (%d sectors at %llu on %pg)\n", mdname(mddev), s, (unsigned long long)( sect + choose_data_offset(r10_bio, rdev)), - bdevname(rdev->bdev, b)); + rdev->bdev); atomic_add(s, &rdev->corrected_errors); } |