Commit 913cce5a authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Song Liu

md: remove most calls to bdevname

Use the %pg format specifier to save on stack consumption and code size.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarSong Liu <song@kernel.org>
parent 1e267742
...@@ -206,7 +206,6 @@ static void linear_free(struct mddev *mddev, void *priv) ...@@ -206,7 +206,6 @@ static void linear_free(struct mddev *mddev, void *priv)
static bool linear_make_request(struct mddev *mddev, struct bio *bio) static bool linear_make_request(struct mddev *mddev, struct bio *bio)
{ {
char b[BDEVNAME_SIZE];
struct dev_info *tmp_dev; struct dev_info *tmp_dev;
sector_t start_sector, end_sector, data_offset; sector_t start_sector, end_sector, data_offset;
sector_t bio_sector = bio->bi_iter.bi_sector; sector_t bio_sector = bio->bi_iter.bi_sector;
...@@ -256,10 +255,10 @@ static bool linear_make_request(struct mddev *mddev, struct bio *bio) ...@@ -256,10 +255,10 @@ static bool linear_make_request(struct mddev *mddev, struct bio *bio)
return true; return true;
out_of_bounds: out_of_bounds:
pr_err("md/linear:%s: make_request: Sector %llu out of bounds on dev %s: %llu sectors, offset %llu\n", pr_err("md/linear:%s: make_request: Sector %llu out of bounds on dev %pg: %llu sectors, offset %llu\n",
mdname(mddev), mdname(mddev),
(unsigned long long)bio->bi_iter.bi_sector, (unsigned long long)bio->bi_iter.bi_sector,
bdevname(tmp_dev->rdev->bdev, b), tmp_dev->rdev->bdev,
(unsigned long long)tmp_dev->rdev->sectors, (unsigned long long)tmp_dev->rdev->sectors,
(unsigned long long)start_sector); (unsigned long long)start_sector);
bio_io_error(bio); bio_io_error(bio);
......
...@@ -87,10 +87,9 @@ static void multipath_end_request(struct bio *bio) ...@@ -87,10 +87,9 @@ static void multipath_end_request(struct bio *bio)
/* /*
* oops, IO error: * oops, IO error:
*/ */
char b[BDEVNAME_SIZE];
md_error (mp_bh->mddev, rdev); md_error (mp_bh->mddev, rdev);
pr_info("multipath: %s: rescheduling sector %llu\n", pr_info("multipath: %pg: rescheduling sector %llu\n",
bdevname(rdev->bdev,b), rdev->bdev,
(unsigned long long)bio->bi_iter.bi_sector); (unsigned long long)bio->bi_iter.bi_sector);
multipath_reschedule_retry(mp_bh); multipath_reschedule_retry(mp_bh);
} else } else
...@@ -154,7 +153,6 @@ static void multipath_status(struct seq_file *seq, struct mddev *mddev) ...@@ -154,7 +153,6 @@ static void multipath_status(struct seq_file *seq, struct mddev *mddev)
static void multipath_error (struct mddev *mddev, struct md_rdev *rdev) static void multipath_error (struct mddev *mddev, struct md_rdev *rdev)
{ {
struct mpconf *conf = mddev->private; struct mpconf *conf = mddev->private;
char b[BDEVNAME_SIZE];
if (conf->raid_disks - mddev->degraded <= 1) { if (conf->raid_disks - mddev->degraded <= 1) {
/* /*
...@@ -177,9 +175,9 @@ static void multipath_error (struct mddev *mddev, struct md_rdev *rdev) ...@@ -177,9 +175,9 @@ static void multipath_error (struct mddev *mddev, struct md_rdev *rdev)
} }
set_bit(Faulty, &rdev->flags); set_bit(Faulty, &rdev->flags);
set_bit(MD_SB_CHANGE_DEVS, &mddev->sb_flags); set_bit(MD_SB_CHANGE_DEVS, &mddev->sb_flags);
pr_err("multipath: IO failure on %s, disabling IO path.\n" pr_err("multipath: IO failure on %pg, disabling IO path.\n"
"multipath: Operation continuing on %d IO paths.\n", "multipath: Operation continuing on %d IO paths.\n",
bdevname(rdev->bdev, b), rdev->bdev,
conf->raid_disks - mddev->degraded); conf->raid_disks - mddev->degraded);
} }
...@@ -197,12 +195,11 @@ static void print_multipath_conf (struct mpconf *conf) ...@@ -197,12 +195,11 @@ static void print_multipath_conf (struct mpconf *conf)
conf->raid_disks); conf->raid_disks);
for (i = 0; i < conf->raid_disks; i++) { for (i = 0; i < conf->raid_disks; i++) {
char b[BDEVNAME_SIZE];
tmp = conf->multipaths + i; tmp = conf->multipaths + i;
if (tmp->rdev) if (tmp->rdev)
pr_debug(" disk%d, o:%d, dev:%s\n", pr_debug(" disk%d, o:%d, dev:%pg\n",
i,!test_bit(Faulty, &tmp->rdev->flags), i,!test_bit(Faulty, &tmp->rdev->flags),
bdevname(tmp->rdev->bdev,b)); tmp->rdev->bdev);
} }
} }
......
This diff is collapsed.
...@@ -37,7 +37,6 @@ static void dump_zones(struct mddev *mddev) ...@@ -37,7 +37,6 @@ static void dump_zones(struct mddev *mddev)
int j, k; int j, k;
sector_t zone_size = 0; sector_t zone_size = 0;
sector_t zone_start = 0; sector_t zone_start = 0;
char b[BDEVNAME_SIZE];
struct r0conf *conf = mddev->private; struct r0conf *conf = mddev->private;
int raid_disks = conf->strip_zone[0].nb_dev; int raid_disks = conf->strip_zone[0].nb_dev;
pr_debug("md: RAID0 configuration for %s - %d zone%s\n", pr_debug("md: RAID0 configuration for %s - %d zone%s\n",
...@@ -48,9 +47,8 @@ static void dump_zones(struct mddev *mddev) ...@@ -48,9 +47,8 @@ static void dump_zones(struct mddev *mddev)
int len = 0; int len = 0;
for (k = 0; k < conf->strip_zone[j].nb_dev; k++) for (k = 0; k < conf->strip_zone[j].nb_dev; k++)
len += snprintf(line+len, 200-len, "%s%s", k?"/":"", len += snprintf(line+len, 200-len, "%s%pg", k?"/":"",
bdevname(conf->devlist[j*raid_disks conf->devlist[j * raid_disks + k]->bdev);
+ k]->bdev, b));
pr_debug("md: zone%d=[%s]\n", j, line); pr_debug("md: zone%d=[%s]\n", j, line);
zone_size = conf->strip_zone[j].zone_end - zone_start; zone_size = conf->strip_zone[j].zone_end - zone_start;
...@@ -69,8 +67,6 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) ...@@ -69,8 +67,6 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
struct md_rdev *smallest, *rdev1, *rdev2, *rdev, **dev; struct md_rdev *smallest, *rdev1, *rdev2, *rdev, **dev;
struct strip_zone *zone; struct strip_zone *zone;
int cnt; int cnt;
char b[BDEVNAME_SIZE];
char b2[BDEVNAME_SIZE];
struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL); struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL);
unsigned blksize = 512; unsigned blksize = 512;
...@@ -78,9 +74,9 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) ...@@ -78,9 +74,9 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
if (!conf) if (!conf)
return -ENOMEM; return -ENOMEM;
rdev_for_each(rdev1, mddev) { rdev_for_each(rdev1, mddev) {
pr_debug("md/raid0:%s: looking at %s\n", pr_debug("md/raid0:%s: looking at %pg\n",
mdname(mddev), mdname(mddev),
bdevname(rdev1->bdev, b)); rdev1->bdev);
c = 0; c = 0;
/* round size to chunk_size */ /* round size to chunk_size */
...@@ -92,12 +88,12 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) ...@@ -92,12 +88,12 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
rdev1->bdev->bd_disk->queue)); rdev1->bdev->bd_disk->queue));
rdev_for_each(rdev2, mddev) { rdev_for_each(rdev2, mddev) {
pr_debug("md/raid0:%s: comparing %s(%llu)" pr_debug("md/raid0:%s: comparing %pg(%llu)"
" with %s(%llu)\n", " with %pg(%llu)\n",
mdname(mddev), mdname(mddev),
bdevname(rdev1->bdev,b), rdev1->bdev,
(unsigned long long)rdev1->sectors, (unsigned long long)rdev1->sectors,
bdevname(rdev2->bdev,b2), rdev2->bdev,
(unsigned long long)rdev2->sectors); (unsigned long long)rdev2->sectors);
if (rdev2 == rdev1) { if (rdev2 == rdev1) {
pr_debug("md/raid0:%s: END\n", pr_debug("md/raid0:%s: END\n",
...@@ -225,15 +221,15 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) ...@@ -225,15 +221,15 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
for (j=0; j<cnt; j++) { for (j=0; j<cnt; j++) {
rdev = conf->devlist[j]; rdev = conf->devlist[j];
if (rdev->sectors <= zone->dev_start) { if (rdev->sectors <= zone->dev_start) {
pr_debug("md/raid0:%s: checking %s ... nope\n", pr_debug("md/raid0:%s: checking %pg ... nope\n",
mdname(mddev), mdname(mddev),
bdevname(rdev->bdev, b)); rdev->bdev);
continue; continue;
} }
pr_debug("md/raid0:%s: checking %s ..." pr_debug("md/raid0:%s: checking %pg ..."
" contained as device %d\n", " contained as device %d\n",
mdname(mddev), mdname(mddev),
bdevname(rdev->bdev, b), c); rdev->bdev, c);
dev[c] = rdev; dev[c] = rdev;
c++; c++;
if (!smallest || rdev->sectors < smallest->sectors) { if (!smallest || rdev->sectors < smallest->sectors) {
......
...@@ -402,10 +402,9 @@ static void raid1_end_read_request(struct bio *bio) ...@@ -402,10 +402,9 @@ static void raid1_end_read_request(struct bio *bio)
/* /*
* oops, read error: * oops, read error:
*/ */
char b[BDEVNAME_SIZE]; pr_err_ratelimited("md/raid1:%s: %pg: rescheduling sector %llu\n",
pr_err_ratelimited("md/raid1:%s: %s: rescheduling sector %llu\n",
mdname(conf->mddev), mdname(conf->mddev),
bdevname(rdev->bdev, b), rdev->bdev,
(unsigned long long)r1_bio->sector); (unsigned long long)r1_bio->sector);
set_bit(R1BIO_ReadError, &r1_bio->state); set_bit(R1BIO_ReadError, &r1_bio->state);
reschedule_retry(r1_bio); reschedule_retry(r1_bio);
...@@ -1283,10 +1282,10 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio, ...@@ -1283,10 +1282,10 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio,
mirror = conf->mirrors + rdisk; mirror = conf->mirrors + rdisk;
if (r1bio_existed) if (r1bio_existed)
pr_info_ratelimited("md/raid1:%s: redirecting sector %llu to other mirror: %s\n", pr_info_ratelimited("md/raid1:%s: redirecting sector %llu to other mirror: %pg\n",
mdname(mddev), mdname(mddev),
(unsigned long long)r1_bio->sector, (unsigned long long)r1_bio->sector,
bdevname(mirror->rdev->bdev, b)); mirror->rdev->bdev);
if (test_bit(WriteMostly, &mirror->rdev->flags) && if (test_bit(WriteMostly, &mirror->rdev->flags) &&
bitmap) { bitmap) {
...@@ -1659,7 +1658,6 @@ static void raid1_status(struct seq_file *seq, struct mddev *mddev) ...@@ -1659,7 +1658,6 @@ static void raid1_status(struct seq_file *seq, struct mddev *mddev)
*/ */
static void raid1_error(struct mddev *mddev, struct md_rdev *rdev) static void raid1_error(struct mddev *mddev, struct md_rdev *rdev)
{ {
char b[BDEVNAME_SIZE];
struct r1conf *conf = mddev->private; struct r1conf *conf = mddev->private;
unsigned long flags; unsigned long flags;
...@@ -1686,9 +1684,9 @@ static void raid1_error(struct mddev *mddev, struct md_rdev *rdev) ...@@ -1686,9 +1684,9 @@ static void raid1_error(struct mddev *mddev, struct md_rdev *rdev)
set_bit(MD_RECOVERY_INTR, &mddev->recovery); set_bit(MD_RECOVERY_INTR, &mddev->recovery);
set_mask_bits(&mddev->sb_flags, 0, set_mask_bits(&mddev->sb_flags, 0,
BIT(MD_SB_CHANGE_DEVS) | BIT(MD_SB_CHANGE_PENDING)); BIT(MD_SB_CHANGE_DEVS) | BIT(MD_SB_CHANGE_PENDING));
pr_crit("md/raid1:%s: Disk failure on %s, disabling device.\n" pr_crit("md/raid1:%s: Disk failure on %pg, disabling device.\n"
"md/raid1:%s: Operation continuing on %d devices.\n", "md/raid1:%s: Operation continuing on %d devices.\n",
mdname(mddev), bdevname(rdev->bdev, b), mdname(mddev), rdev->bdev,
mdname(mddev), conf->raid_disks - mddev->degraded); mdname(mddev), conf->raid_disks - mddev->degraded);
} }
...@@ -1706,13 +1704,12 @@ static void print_conf(struct r1conf *conf) ...@@ -1706,13 +1704,12 @@ static void print_conf(struct r1conf *conf)
rcu_read_lock(); rcu_read_lock();
for (i = 0; i < conf->raid_disks; i++) { for (i = 0; i < conf->raid_disks; i++) {
char b[BDEVNAME_SIZE];
struct md_rdev *rdev = rcu_dereference(conf->mirrors[i].rdev); struct md_rdev *rdev = rcu_dereference(conf->mirrors[i].rdev);
if (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), i, !test_bit(In_sync, &rdev->flags),
!test_bit(Faulty, &rdev->flags), !test_bit(Faulty, &rdev->flags),
bdevname(rdev->bdev,b)); rdev->bdev);
} }
rcu_read_unlock(); rcu_read_unlock();
} }
...@@ -2347,7 +2344,6 @@ static void fix_read_error(struct r1conf *conf, int read_disk, ...@@ -2347,7 +2344,6 @@ static void fix_read_error(struct r1conf *conf, int read_disk,
} }
d = start; d = start;
while (d != read_disk) { while (d != read_disk) {
char b[BDEVNAME_SIZE];
if (d==0) if (d==0)
d = conf->raid_disks * 2; d = conf->raid_disks * 2;
d--; d--;
...@@ -2360,11 +2356,11 @@ static void fix_read_error(struct r1conf *conf, int read_disk, ...@@ -2360,11 +2356,11 @@ static void fix_read_error(struct r1conf *conf, int read_disk,
if (r1_sync_page_io(rdev, sect, s, if (r1_sync_page_io(rdev, sect, s,
conf->tmppage, READ)) { conf->tmppage, READ)) {
atomic_add(s, &rdev->corrected_errors); atomic_add(s, &rdev->corrected_errors);
pr_info("md/raid1:%s: read error corrected (%d sectors at %llu on %s)\n", pr_info("md/raid1:%s: read error corrected (%d sectors at %llu on %pg)\n",
mdname(mddev), s, mdname(mddev), s,
(unsigned long long)(sect + (unsigned long long)(sect +
rdev->data_offset), rdev->data_offset),
bdevname(rdev->bdev, b)); rdev->bdev);
} }
rdev_dec_pending(rdev, mddev); rdev_dec_pending(rdev, mddev);
} else } else
......
...@@ -397,10 +397,9 @@ static void raid10_end_read_request(struct bio *bio) ...@@ -397,10 +397,9 @@ static void raid10_end_read_request(struct bio *bio)
/* /*
* oops, read error - keep the refcount on the rdev * oops, read error - keep the refcount on the rdev
*/ */
char b[BDEVNAME_SIZE]; pr_err_ratelimited("md/raid10:%s: %pg: rescheduling sector %llu\n",
pr_err_ratelimited("md/raid10:%s: %s: rescheduling sector %llu\n",
mdname(conf->mddev), mdname(conf->mddev),
bdevname(rdev->bdev, b), rdev->bdev,
(unsigned long long)r10_bio->sector); (unsigned long long)r10_bio->sector);
set_bit(R10BIO_ReadError, &r10_bio->state); set_bit(R10BIO_ReadError, &r10_bio->state);
reschedule_retry(r10_bio); reschedule_retry(r10_bio);
...@@ -1187,9 +1186,9 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio, ...@@ -1187,9 +1186,9 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio,
return; return;
} }
if (err_rdev) 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), mdname(mddev),
bdevname(rdev->bdev, b), rdev->bdev,
(unsigned long long)r10_bio->sector); (unsigned long long)r10_bio->sector);
if (max_sectors < bio_sectors(bio)) { if (max_sectors < bio_sectors(bio)) {
struct bio *split = bio_split(bio, max_sectors, struct bio *split = bio_split(bio, max_sectors,
...@@ -1987,7 +1986,6 @@ static int enough(struct r10conf *conf, int ignore) ...@@ -1987,7 +1986,6 @@ static int enough(struct r10conf *conf, int ignore)
*/ */
static void raid10_error(struct mddev *mddev, struct md_rdev *rdev) static void raid10_error(struct mddev *mddev, struct md_rdev *rdev)
{ {
char b[BDEVNAME_SIZE];
struct r10conf *conf = mddev->private; struct r10conf *conf = mddev->private;
unsigned long flags; unsigned long flags;
...@@ -2010,9 +2008,9 @@ static void raid10_error(struct mddev *mddev, struct md_rdev *rdev) ...@@ -2010,9 +2008,9 @@ static void raid10_error(struct mddev *mddev, struct md_rdev *rdev)
set_mask_bits(&mddev->sb_flags, 0, set_mask_bits(&mddev->sb_flags, 0,
BIT(MD_SB_CHANGE_DEVS) | BIT(MD_SB_CHANGE_PENDING)); BIT(MD_SB_CHANGE_DEVS) | BIT(MD_SB_CHANGE_PENDING));
spin_unlock_irqrestore(&conf->device_lock, flags); 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", "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); mdname(mddev), conf->geo.raid_disks - mddev->degraded);
} }
...@@ -2032,13 +2030,12 @@ static void print_conf(struct r10conf *conf) ...@@ -2032,13 +2030,12 @@ static void print_conf(struct r10conf *conf)
/* This is only called with ->reconfix_mutex held, so /* This is only called with ->reconfix_mutex held, so
* rcu protection of rdev is not needed */ * rcu protection of rdev is not needed */
for (i = 0; i < conf->geo.raid_disks; i++) { for (i = 0; i < conf->geo.raid_disks; i++) {
char b[BDEVNAME_SIZE];
rdev = conf->mirrors[i].rdev; rdev = conf->mirrors[i].rdev;
if (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), i, !test_bit(In_sync, &rdev->flags),
!test_bit(Faulty, &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 ...@@ -2691,14 +2688,11 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
check_decay_read_errors(mddev, rdev); check_decay_read_errors(mddev, rdev);
atomic_inc(&rdev->read_errors); atomic_inc(&rdev->read_errors);
if (atomic_read(&rdev->read_errors) > max_read_errors) { if (atomic_read(&rdev->read_errors) > max_read_errors) {
char b[BDEVNAME_SIZE]; pr_notice("md/raid10:%s: %pg: Raid device exceeded read_error threshold [cur %d:max %d]\n",
bdevname(rdev->bdev, b); mdname(mddev), rdev->bdev,
pr_notice("md/raid10:%s: %s: Raid device exceeded read_error threshold [cur %d:max %d]\n",
mdname(mddev), b,
atomic_read(&rdev->read_errors), max_read_errors); atomic_read(&rdev->read_errors), max_read_errors);
pr_notice("md/raid10:%s: %s: Failing raid device\n", pr_notice("md/raid10:%s: %pg: Failing raid device\n",
mdname(mddev), b); mdname(mddev), rdev->bdev);
md_error(mddev, rdev); md_error(mddev, rdev);
r10_bio->devs[r10_bio->read_slot].bio = IO_BLOCKED; r10_bio->devs[r10_bio->read_slot].bio = IO_BLOCKED;
return; return;
...@@ -2768,8 +2762,6 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10 ...@@ -2768,8 +2762,6 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
/* write it back and re-read */ /* write it back and re-read */
rcu_read_lock(); rcu_read_lock();
while (sl != r10_bio->read_slot) { while (sl != r10_bio->read_slot) {
char b[BDEVNAME_SIZE];
if (sl==0) if (sl==0)
sl = conf->copies; sl = conf->copies;
sl--; sl--;
...@@ -2788,24 +2780,22 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10 ...@@ -2788,24 +2780,22 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
s, conf->tmppage, WRITE) s, conf->tmppage, WRITE)
== 0) { == 0) {
/* Well, this device is dead */ /* 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, mdname(mddev), s,
(unsigned long long)( (unsigned long long)(
sect + sect +
choose_data_offset(r10_bio, choose_data_offset(r10_bio,
rdev)), rdev)),
bdevname(rdev->bdev, b)); rdev->bdev);
pr_notice("md/raid10:%s: %s: failing drive\n", pr_notice("md/raid10:%s: %pg: failing drive\n",
mdname(mddev), mdname(mddev),
bdevname(rdev->bdev, b)); rdev->bdev);
} }
rdev_dec_pending(rdev, mddev); rdev_dec_pending(rdev, mddev);
rcu_read_lock(); rcu_read_lock();
} }
sl = start; sl = start;
while (sl != r10_bio->read_slot) { while (sl != r10_bio->read_slot) {
char b[BDEVNAME_SIZE];
if (sl==0) if (sl==0)
sl = conf->copies; sl = conf->copies;
sl--; sl--;
...@@ -2825,23 +2815,23 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10 ...@@ -2825,23 +2815,23 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
READ)) { READ)) {
case 0: case 0:
/* Well, this device is dead */ /* 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, mdname(mddev), s,
(unsigned long long)( (unsigned long long)(
sect + sect +
choose_data_offset(r10_bio, rdev)), choose_data_offset(r10_bio, rdev)),
bdevname(rdev->bdev, b)); rdev->bdev);
pr_notice("md/raid10:%s: %s: failing drive\n", pr_notice("md/raid10:%s: %pg: failing drive\n",
mdname(mddev), mdname(mddev),
bdevname(rdev->bdev, b)); rdev->bdev);
break; break;
case 1: 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, mdname(mddev), s,
(unsigned long long)( (unsigned long long)(
sect + sect +
choose_data_offset(r10_bio, rdev)), choose_data_offset(r10_bio, rdev)),
bdevname(rdev->bdev, b)); rdev->bdev);
atomic_add(s, &rdev->corrected_errors); atomic_add(s, &rdev->corrected_errors);
} }
......
...@@ -3064,11 +3064,10 @@ int r5l_init_log(struct r5conf *conf, struct md_rdev *rdev) ...@@ -3064,11 +3064,10 @@ int r5l_init_log(struct r5conf *conf, struct md_rdev *rdev)
{ {
struct request_queue *q = bdev_get_queue(rdev->bdev); struct request_queue *q = bdev_get_queue(rdev->bdev);
struct r5l_log *log; struct r5l_log *log;
char b[BDEVNAME_SIZE];
int ret; int ret;
pr_debug("md/raid:%s: using device %s as journal\n", pr_debug("md/raid:%s: using device %pg as journal\n",
mdname(conf->mddev), bdevname(rdev->bdev, b)); mdname(conf->mddev), rdev->bdev);
if (PAGE_SIZE != 4096) if (PAGE_SIZE != 4096)
return -EINVAL; return -EINVAL;
......
...@@ -798,7 +798,6 @@ static int ppl_recover_entry(struct ppl_log *log, struct ppl_header_entry *e, ...@@ -798,7 +798,6 @@ static int ppl_recover_entry(struct ppl_log *log, struct ppl_header_entry *e,
int data_disks; int data_disks;
int i; int i;
int ret = 0; int ret = 0;
char b[BDEVNAME_SIZE];
unsigned int pp_size = le32_to_cpu(e->pp_size); unsigned int pp_size = le32_to_cpu(e->pp_size);
unsigned int data_size = le32_to_cpu(e->data_size); unsigned int data_size = le32_to_cpu(e->data_size);
...@@ -894,8 +893,8 @@ static int ppl_recover_entry(struct ppl_log *log, struct ppl_header_entry *e, ...@@ -894,8 +893,8 @@ static int ppl_recover_entry(struct ppl_log *log, struct ppl_header_entry *e,
break; break;
} }
pr_debug("%s:%*s reading data member disk %s sector %llu\n", pr_debug("%s:%*s reading data member disk %pg sector %llu\n",
__func__, indent, "", bdevname(rdev->bdev, b), __func__, indent, "", rdev->bdev,
(unsigned long long)sector); (unsigned long long)sector);
if (!sync_page_io(rdev, sector, block_size, page2, if (!sync_page_io(rdev, sector, block_size, page2,
REQ_OP_READ, 0, false)) { REQ_OP_READ, 0, false)) {
...@@ -942,10 +941,10 @@ static int ppl_recover_entry(struct ppl_log *log, struct ppl_header_entry *e, ...@@ -942,10 +941,10 @@ static int ppl_recover_entry(struct ppl_log *log, struct ppl_header_entry *e,
conf->disks[sh.pd_idx].rdev, 1); conf->disks[sh.pd_idx].rdev, 1);
BUG_ON(parity_rdev->bdev->bd_dev != log->rdev->bdev->bd_dev); BUG_ON(parity_rdev->bdev->bd_dev != log->rdev->bdev->bd_dev);
pr_debug("%s:%*s write parity at sector %llu, disk %s\n", pr_debug("%s:%*s write parity at sector %llu, disk %pg\n",
__func__, indent, "", __func__, indent, "",
(unsigned long long)parity_sector, (unsigned long long)parity_sector,
bdevname(parity_rdev->bdev, b)); parity_rdev->bdev);
if (!sync_page_io(parity_rdev, parity_sector, block_size, if (!sync_page_io(parity_rdev, parity_sector, block_size,
page1, REQ_OP_WRITE, 0, false)) { page1, REQ_OP_WRITE, 0, false)) {
pr_debug("%s:%*s parity write error!\n", __func__, pr_debug("%s:%*s parity write error!\n", __func__,
...@@ -1255,7 +1254,6 @@ void ppl_exit_log(struct r5conf *conf) ...@@ -1255,7 +1254,6 @@ void ppl_exit_log(struct r5conf *conf)
static int ppl_validate_rdev(struct md_rdev *rdev) static int ppl_validate_rdev(struct md_rdev *rdev)
{ {
char b[BDEVNAME_SIZE];
int ppl_data_sectors; int ppl_data_sectors;
int ppl_size_new; int ppl_size_new;
...@@ -1272,8 +1270,8 @@ static int ppl_validate_rdev(struct md_rdev *rdev) ...@@ -1272,8 +1270,8 @@ static int ppl_validate_rdev(struct md_rdev *rdev)
RAID5_STRIPE_SECTORS((struct r5conf *)rdev->mddev->private)); RAID5_STRIPE_SECTORS((struct r5conf *)rdev->mddev->private));
if (ppl_data_sectors <= 0) { if (ppl_data_sectors <= 0) {
pr_warn("md/raid:%s: PPL space too small on %s\n", pr_warn("md/raid:%s: PPL space too small on %pg\n",
mdname(rdev->mddev), bdevname(rdev->bdev, b)); mdname(rdev->mddev), rdev->bdev);
return -ENOSPC; return -ENOSPC;
} }
...@@ -1283,16 +1281,16 @@ static int ppl_validate_rdev(struct md_rdev *rdev) ...@@ -1283,16 +1281,16 @@ static int ppl_validate_rdev(struct md_rdev *rdev)
rdev->ppl.sector + ppl_size_new > rdev->data_offset) || rdev->ppl.sector + ppl_size_new > rdev->data_offset) ||
(rdev->ppl.sector >= rdev->data_offset && (rdev->ppl.sector >= rdev->data_offset &&
rdev->data_offset + rdev->sectors > rdev->ppl.sector)) { rdev->data_offset + rdev->sectors > rdev->ppl.sector)) {
pr_warn("md/raid:%s: PPL space overlaps with data on %s\n", pr_warn("md/raid:%s: PPL space overlaps with data on %pg\n",
mdname(rdev->mddev), bdevname(rdev->bdev, b)); mdname(rdev->mddev), rdev->bdev);
return -EINVAL; return -EINVAL;
} }
if (!rdev->mddev->external && if (!rdev->mddev->external &&
((rdev->ppl.offset > 0 && rdev->ppl.offset < (rdev->sb_size >> 9)) || ((rdev->ppl.offset > 0 && rdev->ppl.offset < (rdev->sb_size >> 9)) ||
(rdev->ppl.offset <= 0 && rdev->ppl.offset + ppl_size_new > 0))) { (rdev->ppl.offset <= 0 && rdev->ppl.offset + ppl_size_new > 0))) {
pr_warn("md/raid:%s: PPL space overlaps with superblock on %s\n", pr_warn("md/raid:%s: PPL space overlaps with superblock on %pg\n",
mdname(rdev->mddev), bdevname(rdev->bdev, b)); mdname(rdev->mddev), rdev->bdev);
return -EINVAL; return -EINVAL;
} }
...@@ -1463,14 +1461,13 @@ int ppl_modify_log(struct r5conf *conf, struct md_rdev *rdev, bool add) ...@@ -1463,14 +1461,13 @@ int ppl_modify_log(struct r5conf *conf, struct md_rdev *rdev, bool add)
struct ppl_conf *ppl_conf = conf->log_private; struct ppl_conf *ppl_conf = conf->log_private;
struct ppl_log *log; struct ppl_log *log;
int ret = 0; int ret = 0;
char b[BDEVNAME_SIZE];
if (!rdev) if (!rdev)
return -EINVAL; return -EINVAL;
pr_debug("%s: disk: %d operation: %s dev: %s\n", pr_debug("%s: disk: %d operation: %s dev: %pg\n",
__func__, rdev->raid_disk, add ? "add" : "remove", __func__, rdev->raid_disk, add ? "add" : "remove",
bdevname(rdev->bdev, b)); rdev->bdev);
if (rdev->raid_disk < 0) if (rdev->raid_disk < 0)
return 0; return 0;
......
...@@ -2686,7 +2686,6 @@ static void raid5_end_read_request(struct bio * bi) ...@@ -2686,7 +2686,6 @@ static void raid5_end_read_request(struct bio * bi)
struct stripe_head *sh = bi->bi_private; struct stripe_head *sh = bi->bi_private;
struct r5conf *conf = sh->raid_conf; struct r5conf *conf = sh->raid_conf;
int disks = sh->disks, i; int disks = sh->disks, i;
char b[BDEVNAME_SIZE];
struct md_rdev *rdev = NULL; struct md_rdev *rdev = NULL;
sector_t s; sector_t s;
...@@ -2723,10 +2722,10 @@ static void raid5_end_read_request(struct bio * bi) ...@@ -2723,10 +2722,10 @@ static void raid5_end_read_request(struct bio * bi)
* any error * any error
*/ */
pr_info_ratelimited( pr_info_ratelimited(
"md/raid:%s: read error corrected (%lu sectors at %llu on %s)\n", "md/raid:%s: read error corrected (%lu sectors at %llu on %pg)\n",
mdname(conf->mddev), RAID5_STRIPE_SECTORS(conf), mdname(conf->mddev), RAID5_STRIPE_SECTORS(conf),
(unsigned long long)s, (unsigned long long)s,
bdevname(rdev->bdev, b)); rdev->bdev);
atomic_add(RAID5_STRIPE_SECTORS(conf), &rdev->corrected_errors); atomic_add(RAID5_STRIPE_SECTORS(conf), &rdev->corrected_errors);
clear_bit(R5_ReadError, &sh->dev[i].flags); clear_bit(R5_ReadError, &sh->dev[i].flags);
clear_bit(R5_ReWrite, &sh->dev[i].flags); clear_bit(R5_ReWrite, &sh->dev[i].flags);
...@@ -2743,7 +2742,6 @@ static void raid5_end_read_request(struct bio * bi) ...@@ -2743,7 +2742,6 @@ static void raid5_end_read_request(struct bio * bi)
if (atomic_read(&rdev->read_errors)) if (atomic_read(&rdev->read_errors))
atomic_set(&rdev->read_errors, 0); atomic_set(&rdev->read_errors, 0);
} else { } else {
const char *bdn = bdevname(rdev->bdev, b);
int retry = 0; int retry = 0;
int set_bad = 0; int set_bad = 0;
...@@ -2752,25 +2750,25 @@ static void raid5_end_read_request(struct bio * bi) ...@@ -2752,25 +2750,25 @@ static void raid5_end_read_request(struct bio * bi)
atomic_inc(&rdev->read_errors); atomic_inc(&rdev->read_errors);
if (test_bit(R5_ReadRepl, &sh->dev[i].flags)) if (test_bit(R5_ReadRepl, &sh->dev[i].flags))
pr_warn_ratelimited( pr_warn_ratelimited(
"md/raid:%s: read error on replacement device (sector %llu on %s).\n", "md/raid:%s: read error on replacement device (sector %llu on %pg).\n",
mdname(conf->mddev), mdname(conf->mddev),
(unsigned long long)s, (unsigned long long)s,
bdn); rdev->bdev);
else if (conf->mddev->degraded >= conf->max_degraded) { else if (conf->mddev->degraded >= conf->max_degraded) {
set_bad = 1; set_bad = 1;
pr_warn_ratelimited( pr_warn_ratelimited(
"md/raid:%s: read error not correctable (sector %llu on %s).\n", "md/raid:%s: read error not correctable (sector %llu on %pg).\n",
mdname(conf->mddev), mdname(conf->mddev),
(unsigned long long)s, (unsigned long long)s,
bdn); rdev->bdev);
} else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) { } else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) {
/* Oh, no!!! */ /* Oh, no!!! */
set_bad = 1; set_bad = 1;
pr_warn_ratelimited( pr_warn_ratelimited(
"md/raid:%s: read error NOT corrected!! (sector %llu on %s).\n", "md/raid:%s: read error NOT corrected!! (sector %llu on %pg).\n",
mdname(conf->mddev), mdname(conf->mddev),
(unsigned long long)s, (unsigned long long)s,
bdn); rdev->bdev);
} else if (atomic_read(&rdev->read_errors) } else if (atomic_read(&rdev->read_errors)
> conf->max_nr_stripes) { > conf->max_nr_stripes) {
if (!test_bit(Faulty, &rdev->flags)) { if (!test_bit(Faulty, &rdev->flags)) {
...@@ -2778,8 +2776,8 @@ static void raid5_end_read_request(struct bio * bi) ...@@ -2778,8 +2776,8 @@ static void raid5_end_read_request(struct bio * bi)
mdname(conf->mddev), mdname(conf->mddev),
atomic_read(&rdev->read_errors), atomic_read(&rdev->read_errors),
conf->max_nr_stripes); conf->max_nr_stripes);
pr_warn("md/raid:%s: Too many read errors, failing device %s.\n", pr_warn("md/raid:%s: Too many read errors, failing device %pg.\n",
mdname(conf->mddev), bdn); mdname(conf->mddev), rdev->bdev);
} }
} else } else
retry = 1; retry = 1;
...@@ -2891,13 +2889,12 @@ static void raid5_end_write_request(struct bio *bi) ...@@ -2891,13 +2889,12 @@ static void raid5_end_write_request(struct bio *bi)
static void raid5_error(struct mddev *mddev, struct md_rdev *rdev) static void raid5_error(struct mddev *mddev, struct md_rdev *rdev)
{ {
char b[BDEVNAME_SIZE];
struct r5conf *conf = mddev->private; struct r5conf *conf = mddev->private;
unsigned long flags; unsigned long flags;
pr_debug("raid456: error called\n"); pr_debug("raid456: error called\n");
pr_crit("md/raid:%s: Disk failure on %s, disabling device.\n", pr_crit("md/raid:%s: Disk failure on %pg, disabling device.\n",
mdname(mddev), bdevname(rdev->bdev, b)); mdname(mddev), rdev->bdev);
spin_lock_irqsave(&conf->device_lock, flags); spin_lock_irqsave(&conf->device_lock, flags);
set_bit(Faulty, &rdev->flags); set_bit(Faulty, &rdev->flags);
...@@ -7359,9 +7356,8 @@ static struct r5conf *setup_conf(struct mddev *mddev) ...@@ -7359,9 +7356,8 @@ static struct r5conf *setup_conf(struct mddev *mddev)
} }
if (test_bit(In_sync, &rdev->flags)) { if (test_bit(In_sync, &rdev->flags)) {
char b[BDEVNAME_SIZE]; pr_info("md/raid:%s: device %pg operational as raid disk %d\n",
pr_info("md/raid:%s: device %s operational as raid disk %d\n", mdname(mddev), rdev->bdev, raid_disk);
mdname(mddev), bdevname(rdev->bdev, b), raid_disk);
} else if (rdev->saved_raid_disk != raid_disk) } else if (rdev->saved_raid_disk != raid_disk)
/* Cannot rely on bitmap to complete recovery */ /* Cannot rely on bitmap to complete recovery */
conf->fullsync = 1; conf->fullsync = 1;
...@@ -7877,12 +7873,11 @@ static void print_raid5_conf (struct r5conf *conf) ...@@ -7877,12 +7873,11 @@ static void print_raid5_conf (struct r5conf *conf)
rcu_read_lock(); rcu_read_lock();
for (i = 0; i < conf->raid_disks; i++) { for (i = 0; i < conf->raid_disks; i++) {
char b[BDEVNAME_SIZE];
rdev = rcu_dereference(conf->disks[i].rdev); rdev = rcu_dereference(conf->disks[i].rdev);
if (rdev) if (rdev)
pr_debug(" disk %d, o:%d, dev:%s\n", pr_debug(" disk %d, o:%d, dev:%pg\n",
i, !test_bit(Faulty, &rdev->flags), i, !test_bit(Faulty, &rdev->flags),
bdevname(rdev->bdev, b)); rdev->bdev);
} }
rcu_read_unlock(); rcu_read_unlock();
} }
......
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