summaryrefslogtreecommitdiff
path: root/block/partitions
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-11-24 11:37:14 +0300
committerJens Axboe <axboe@kernel.dk>2020-12-02 00:53:40 +0300
commit41e5c81984eac8ce87f2b4f57fec0bd90a049b2b (patch)
treee3df22a54db95b1875e8680a9c77e131cddee383 /block/partitions
parent8446fe9255be821cb38ffd306d7e8edc4b9ea662 (diff)
downloadlinux-41e5c81984eac8ce87f2b4f57fec0bd90a049b2b.tar.xz
block: remove the partno field from struct hd_struct
Just use the bd_partno field in struct block_device everywhere. 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.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/block/partitions/core.c b/block/partitions/core.c
index c2f6721633b8..6db9ca8b722d 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -184,7 +184,7 @@ static ssize_t part_partition_show(struct device *dev,
{
struct hd_struct *p = dev_to_part(dev);
- return sprintf(buf, "%d\n", p->partno);
+ return sprintf(buf, "%d\n", p->bdev->bd_partno);
}
static ssize_t part_start_show(struct device *dev,
@@ -274,7 +274,7 @@ static int part_uevent(struct device *dev, struct kobj_uevent_env *env)
{
struct hd_struct *part = dev_to_part(dev);
- add_uevent_var(env, "PARTN=%u", part->partno);
+ add_uevent_var(env, "PARTN=%u", part->bdev->bd_partno);
if (part->bdev->bd_meta_info && part->bdev->bd_meta_info->volname[0])
add_uevent_var(env, "PARTNAME=%s",
part->bdev->bd_meta_info->volname);
@@ -298,7 +298,7 @@ void delete_partition(struct hd_struct *part)
struct disk_part_tbl *ptbl =
rcu_dereference_protected(disk->part_tbl, 1);
- rcu_assign_pointer(ptbl->part[part->partno], NULL);
+ rcu_assign_pointer(ptbl->part[part->bdev->bd_partno], NULL);
rcu_assign_pointer(ptbl->last_lookup, NULL);
kobject_put(part->bdev->bd_holder_dir);
@@ -372,7 +372,6 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno,
bdev->bd_start_sect = start;
bdev_set_nr_sectors(bdev, len);
- p->partno = partno;
bdev->bd_read_only = get_disk_ro(disk);
if (info) {
@@ -445,7 +444,7 @@ 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 ||
+ 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)