summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-11-23 16:38:15 +0100
committerJens Axboe <axboe@kernel.dk>2020-12-01 22:53:40 +0100
commitc64dc3bd87097e7f08b9437819440f8bfddef995 (patch)
treec73cc15e2ae2c2d7a6141607e7d3c3d8f68dd667
parentblock: simplify the block device claiming interface (diff)
downloadlinux-c64dc3bd87097e7f08b9437819440f8bfddef995.tar.xz
linux-c64dc3bd87097e7f08b9437819440f8bfddef995.zip
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 <hch@lst.de> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Hannes Reinecke <hare@suse.de> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--include/linux/genhd.h10
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)