aboutsummaryrefslogtreecommitdiffstats
path: root/block/partitions
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-11-24 09:52:59 +0100
committerJens Axboe <axboe@kernel.dk>2020-12-01 14:53:40 -0700
commitad1eaa5344b293552b6ba43f5709c76a9aa14d17 (patch)
treecb711254c057aaa967bb392a53ad0a6eb00072cc /block/partitions
parentblock: pass a block_device to invalidate_partition (diff)
downloadlinux-dev-ad1eaa5344b293552b6ba43f5709c76a9aa14d17.tar.xz
linux-dev-ad1eaa5344b293552b6ba43f5709c76a9aa14d17.zip
block: switch disk_part_iter_* to use a struct block_device
Switch the partition iter infrastructure to iterate over block_device references instead of hd_struct ones mostly used to get at the block_device. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/partitions')
-rw-r--r--block/partitions/core.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/block/partitions/core.c b/block/partitions/core.c
index 3d8243334c7c..4cb6df175f90 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -439,15 +439,14 @@ static bool partition_overlaps(struct gendisk *disk, sector_t start,
sector_t length, int skip_partno)
{
struct disk_part_iter piter;
- struct hd_struct *part;
+ struct block_device *part;
bool overlap = false;
disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY);
while ((part = disk_part_iter_next(&piter))) {
- if (part->bdev->bd_partno == skip_partno ||
- start >= part->bdev->bd_start_sect +
- bdev_nr_sectors(part->bdev) ||
- start + length <= part->bdev->bd_start_sect)
+ if (part->bd_partno == skip_partno ||
+ start >= part->bd_start_sect + bdev_nr_sectors(part) ||
+ start + length <= part->bd_start_sect)
continue;
overlap = true;
break;
@@ -568,7 +567,7 @@ static bool disk_unlock_native_capacity(struct gendisk *disk)
int blk_drop_partitions(struct block_device *bdev)
{
struct disk_part_iter piter;
- struct hd_struct *part;
+ struct block_device *part;
if (bdev->bd_part_count)
return -EBUSY;
@@ -578,7 +577,7 @@ int blk_drop_partitions(struct block_device *bdev)
disk_part_iter_init(&piter, bdev->bd_disk, DISK_PITER_INCL_EMPTY);
while ((part = disk_part_iter_next(&piter)))
- delete_partition(part);
+ delete_partition(part->bd_part);
disk_part_iter_exit(&piter);
return 0;