summaryrefslogtreecommitdiff
path: root/block/partitions
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-11-24 09:34:24 +0100
committerJens Axboe <axboe@kernel.dk>2020-12-01 14:53:40 -0700
commit29ff57c61094e7bbd921ab10b5a99dce9a0132e0 (patch)
tree76d8351cff0fdd01e9261fd0e4374e464d2899ca /block/partitions
parent15e3d2c5cd53298272e59ad9072d3468f9dd3781 (diff)
block: move the start_sect field to struct block_device
Move the start_sect field to struct block_device in preparation of killing struct hd_struct. 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.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/block/partitions/core.c b/block/partitions/core.c
index 8924e1ea8b2a..460a745812c6 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -192,7 +192,7 @@ static ssize_t part_start_show(struct device *dev,
{
struct hd_struct *p = dev_to_part(dev);
- return sprintf(buf, "%llu\n",(unsigned long long)p->start_sect);
+ return sprintf(buf, "%llu\n", p->bdev->bd_start_sect);
}
static ssize_t part_ro_show(struct device *dev,
@@ -209,7 +209,7 @@ static ssize_t part_alignment_offset_show(struct device *dev,
return sprintf(buf, "%u\n",
queue_limit_alignment_offset(&part_to_disk(p)->queue->limits,
- p->start_sect));
+ p->bdev->bd_start_sect));
}
static ssize_t part_discard_alignment_show(struct device *dev,
@@ -219,7 +219,7 @@ static ssize_t part_discard_alignment_show(struct device *dev,
return sprintf(buf, "%u\n",
queue_limit_discard_alignment(&part_to_disk(p)->queue->limits,
- p->start_sect));
+ p->bdev->bd_start_sect));
}
static DEVICE_ATTR(partition, 0444, part_partition_show, NULL);
@@ -301,7 +301,7 @@ static void hd_struct_free_work(struct work_struct *work)
*/
put_device(disk_to_dev(disk));
- part->start_sect = 0;
+ part->bdev->bd_start_sect = 0;
bdev_set_nr_sectors(part->bdev, 0);
part_stat_set_all(part, 0);
put_device(part_to_dev(part));
@@ -416,7 +416,7 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno,
pdev = part_to_dev(p);
- p->start_sect = start;
+ bdev->bd_start_sect = start;
bdev_set_nr_sectors(bdev, len);
p->partno = partno;
p->policy = get_disk_ro(disk);
@@ -508,8 +508,9 @@ static bool partition_overlaps(struct gendisk *disk, sector_t start,
disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY);
while ((part = disk_part_iter_next(&piter))) {
if (part->partno == skip_partno ||
- start >= part->start_sect + bdev_nr_sectors(part->bdev) ||
- start + length <= part->start_sect)
+ start >= part->bdev->bd_start_sect +
+ bdev_nr_sectors(part->bdev) ||
+ start + length <= part->bdev->bd_start_sect)
continue;
overlap = true;
break;
@@ -592,7 +593,7 @@ int bdev_resize_partition(struct block_device *bdev, int partno,
mutex_lock_nested(&bdev->bd_mutex, 1);
ret = -EINVAL;
- if (start != part->start_sect)
+ if (start != part->bdev->bd_start_sect)
goto out_unlock;
ret = -EBUSY;