diff options
author | Christoph Hellwig <hch@lst.de> | 2022-05-12 08:19:13 +0200 |
---|---|---|
committer | Song Liu <song@kernel.org> | 2022-05-23 08:07:21 +0200 |
commit | 913cce5a1e588e3470ea064fe4ea336037d3a454 (patch) | |
tree | d5335aef357429a908652048eb5c83292640a612 /drivers/md/raid0.c | |
parent | md: protect md_unregister_thread from reentrancy (diff) | |
download | linux-913cce5a1e588e3470ea064fe4ea336037d3a454.tar.xz linux-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/raid0.c')
-rw-r--r-- | drivers/md/raid0.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index e11701e394ca..e3bc38b6c61f 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -37,7 +37,6 @@ static void dump_zones(struct mddev *mddev) int j, k; sector_t zone_size = 0; sector_t zone_start = 0; - char b[BDEVNAME_SIZE]; struct r0conf *conf = mddev->private; int raid_disks = conf->strip_zone[0].nb_dev; pr_debug("md: RAID0 configuration for %s - %d zone%s\n", @@ -48,9 +47,8 @@ static void dump_zones(struct mddev *mddev) int len = 0; for (k = 0; k < conf->strip_zone[j].nb_dev; k++) - len += snprintf(line+len, 200-len, "%s%s", k?"/":"", - bdevname(conf->devlist[j*raid_disks - + k]->bdev, b)); + len += snprintf(line+len, 200-len, "%s%pg", k?"/":"", + conf->devlist[j * raid_disks + k]->bdev); pr_debug("md: zone%d=[%s]\n", j, line); 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) struct md_rdev *smallest, *rdev1, *rdev2, *rdev, **dev; struct strip_zone *zone; int cnt; - char b[BDEVNAME_SIZE]; - char b2[BDEVNAME_SIZE]; struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL); unsigned blksize = 512; @@ -78,9 +74,9 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) if (!conf) return -ENOMEM; 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), - bdevname(rdev1->bdev, b)); + rdev1->bdev); c = 0; /* round size to chunk_size */ @@ -92,12 +88,12 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) rdev1->bdev->bd_disk->queue)); rdev_for_each(rdev2, mddev) { - pr_debug("md/raid0:%s: comparing %s(%llu)" - " with %s(%llu)\n", + pr_debug("md/raid0:%s: comparing %pg(%llu)" + " with %pg(%llu)\n", mdname(mddev), - bdevname(rdev1->bdev,b), + rdev1->bdev, (unsigned long long)rdev1->sectors, - bdevname(rdev2->bdev,b2), + rdev2->bdev, (unsigned long long)rdev2->sectors); if (rdev2 == rdev1) { pr_debug("md/raid0:%s: END\n", @@ -225,15 +221,15 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) for (j=0; j<cnt; j++) { rdev = conf->devlist[j]; 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), - bdevname(rdev->bdev, b)); + rdev->bdev); continue; } - pr_debug("md/raid0:%s: checking %s ..." + pr_debug("md/raid0:%s: checking %pg ..." " contained as device %d\n", mdname(mddev), - bdevname(rdev->bdev, b), c); + rdev->bdev, c); dev[c] = rdev; c++; if (!smallest || rdev->sectors < smallest->sectors) { |