summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-07-27 08:25:14 +0200
committerJens Axboe <axboe@kernel.dk>2021-08-02 13:37:28 -0600
commita9e7bc3de4051d037a8e6f2d30448c347263737e (patch)
tree559bdfd9628f692832674f8758d4152c4bdfe9bd /block
parent26e2d7a362f6a83146ea3eaa8f17ca9ce35388d3 (diff)
block: use the %pg format specifier in printk_all_partitions
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-3-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/genhd.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/block/genhd.c b/block/genhd.c
index cf705cf95440..770f21b4fd1a 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -678,7 +678,6 @@ void __init printk_all_partitions(void)
while ((dev = class_dev_iter_next(&iter))) {
struct gendisk *disk = dev_to_disk(dev);
struct block_device *part;
- char name_buf[BDEVNAME_SIZE];
char devt_buf[BDEVT_SIZE];
unsigned long idx;
@@ -698,11 +697,10 @@ void __init printk_all_partitions(void)
xa_for_each(&disk->part_tbl, idx, part) {
if (!bdev_nr_sectors(part))
continue;
- printk("%s%s %10llu %s %s",
+ printk("%s%s %10llu %pg %s",
bdev_is_partition(part) ? " " : "",
bdevt_str(part->bd_dev, devt_buf),
- bdev_nr_sectors(part) >> 1,
- disk_name(disk, part->bd_partno, name_buf),
+ bdev_nr_sectors(part) >> 1, part,
part->bd_meta_info ?
part->bd_meta_info->uuid : "");
if (bdev_is_partition(part))