diff options
| author | Christoph Hellwig <[email protected]> | 2020-11-23 16:38:15 +0100 |
|---|---|---|
| committer | Jens Axboe <[email protected]> | 2020-12-01 14:53:40 -0700 |
| commit | c64dc3bd87097e7f08b9437819440f8bfddef995 (patch) | |
| tree | c73cc15e2ae2c2d7a6141607e7d3c3d8f68dd667 /include/linux | |
| parent | 37c3fc9abb25cd767ad5b048358336ac89488c16 (diff) | |
block: simplify part_to_disk
Now that struct hd_struct has a block_device pointer use that to
find the disk.
Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Reviewed-by: Hannes Reinecke <[email protected]>
Acked-by: Tejun Heo <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/genhd.h | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 42a51653c730..6ba91ee54cb2 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -218,13 +218,9 @@ struct gendisk { static inline struct gendisk *part_to_disk(struct hd_struct *part) { - if (likely(part)) { - if (part->partno) - return dev_to_disk(part_to_dev(part)->parent); - else - return dev_to_disk(part_to_dev(part)); - } - return NULL; + if (unlikely(!part)) + return NULL; + return part->bdev->bd_disk; } static inline int disk_max_parts(struct gendisk *disk) |