summaryrefslogtreecommitdiffstats
path: root/block/genhd.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-07-27 08:25:15 +0200
committerJens Axboe <axboe@kernel.dk>2021-08-02 13:37:28 -0600
commita291bb43e5c9fdedc4be3dfd496e64e7c5a78b1f (patch)
treefe5e4cc05c5a1a086b46188d8fc01e17b5368ac8 /block/genhd.c
parenta9e7bc3de4051d037a8e6f2d30448c347263737e (diff)
downloadlinux-a291bb43e5c9fdedc4be3dfd496e64e7c5a78b1f.tar.gz
linux-a291bb43e5c9fdedc4be3dfd496e64e7c5a78b1f.tar.bz2
linux-a291bb43e5c9fdedc4be3dfd496e64e7c5a78b1f.zip
block: use the %pg format specifier in show_partition
Simplify printing the partition name by using the %pg format specifier that is equivalent to a bdevname call. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Link: https://lore.kernel.org/r/20210727062518.122108-4-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/genhd.c')
-rw-r--r--block/genhd.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/block/genhd.c b/block/genhd.c
index 770f21b4fd1a..6ed58fda2c05 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -778,7 +778,6 @@ static int show_partition(struct seq_file *seqf, void *v)
struct gendisk *sgp = v;
struct block_device *part;
unsigned long idx;
- char buf[BDEVNAME_SIZE];
/* Don't show non-partitionable removeable devices or empty devices */
if (!get_capacity(sgp) || (!disk_max_parts(sgp) &&
@@ -791,10 +790,9 @@ static int show_partition(struct seq_file *seqf, void *v)
xa_for_each(&sgp->part_tbl, idx, part) {
if (!bdev_nr_sectors(part))
continue;
- seq_printf(seqf, "%4d %7d %10llu %s\n",
+ seq_printf(seqf, "%4d %7d %10llu %pg\n",
MAJOR(part->bd_dev), MINOR(part->bd_dev),
- bdev_nr_sectors(part) >> 1,
- disk_name(sgp, part->bd_partno, buf));
+ bdev_nr_sectors(part) >> 1, part);
}
rcu_read_unlock();
return 0;