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>
This commit is contained in:
parent
37c3fc9abb
commit
c64dc3bd87
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user