Skip to content

Commit

Permalink
vsprintf: use bd_partno in bdev_name
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christoph Hellwig authored and Jens Axboe committed Sep 25, 2020
1 parent 8a63a86 commit 700cd59
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/vsprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 700cd59

Please sign in to comment.