vsprintf: use bd_partno in bdev_name
authorChristoph Hellwig <hch@lst.de>
Thu, 3 Sep 2020 05:41:04 +0000 (07:41 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 25 Sep 2020 14:18:58 +0000 (08:18 -0600)
No need to go through the hd_struct to find the partition number.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
lib/vsprintf.c

index afb9521..14c9a6a 100644 (file)
@@ -940,13 +940,13 @@ char *bdev_name(char *buf, char *end, struct block_device *bdev,
 
        hd = bdev->bd_disk;
        buf = string(buf, end, hd->disk_name, spec);
-       if (bdev->bd_part->partno) {
+       if (bdev->bd_partno) {
                if (isdigit(hd->disk_name[strlen(hd->disk_name)-1])) {
                        if (buf < end)
                                *buf = 'p';
                        buf++;
                }
-               buf = number(buf, end, bdev->bd_part->partno, spec);
+               buf = number(buf, end, bdev->bd_partno, spec);
        }
        return buf;
 }