aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorChristoph Hellwig2020-11-24 12:01:45 +0100
committerJens Axboe2020-12-01 14:53:40 -0700
commit231926dbf0f084211e4ec4f4c006f0bf1f47809a (patch)
tree77076293127f7e2b7f216f5b6b63e72cb97f97f1 /block
parent29ff57c61094e7bbd921ab10b5a99dce9a0132e0 (diff)
block: move the partition_meta_info to struct block_device
Move the partition_meta_info to struct block_device in preparation for 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')
-rw-r--r--block/blk.h1
-rw-r--r--block/genhd.c3
-rw-r--r--block/partitions/core.c18
3 files changed, 9 insertions, 13 deletions
diff --git a/block/blk.h b/block/blk.h
index 3f801f6e86f8..0bd4b58bcbaf 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -381,7 +381,6 @@ static inline void hd_struct_put(struct hd_struct *part)
static inline void hd_free_part(struct hd_struct *part)
{
- kfree(part->info);
bdput(part->bdev);
percpu_ref_exit(&part->ref);
}
diff --git a/block/genhd.c b/block/genhd.c
index 5efb2df1f079..4273e89f07e8 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1010,7 +1010,8 @@ void __init printk_all_partitions(void)
bdevt_str(part_devt(part), devt_buf),
bdev_nr_sectors(part->bdev) >> 1,
disk_name(disk, part->partno, name_buf),
- part->info ? part->info->uuid : "");
+ part->bdev->bd_meta_info ?
+ part->bdev->bd_meta_info->uuid : "");
if (is_part0) {
if (dev->parent && dev->parent->driver)
printk(" driver: %s\n",
diff --git a/block/partitions/core.c b/block/partitions/core.c
index 460a745812c6..07df9ff55462 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -275,8 +275,9 @@ 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);
- if (part->info && part->info->volname[0])
- add_uevent_var(env, "PARTNAME=%s", part->info->volname);
+ 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);
return 0;
}
@@ -422,13 +423,10 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno,
p->policy = get_disk_ro(disk);
if (info) {
- struct partition_meta_info *pinfo;
-
- pinfo = kzalloc_node(sizeof(*pinfo), GFP_KERNEL, disk->node_id);
- if (!pinfo)
+ err = -ENOMEM;
+ bdev->bd_meta_info = kmemdup(info, sizeof(*info), GFP_KERNEL);
+ if (!bdev->bd_meta_info)
goto out_bdput;
- memcpy(pinfo, info, sizeof(*info));
- p->info = pinfo;
}
dname = dev_name(ddev);
@@ -444,7 +442,7 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno,
err = blk_alloc_devt(p, &devt);
if (err)
- goto out_free_info;
+ goto out_bdput;
pdev->devt = devt;
/* delay uevent until 'holders' subdir is created */
@@ -481,8 +479,6 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno,
kobject_uevent(&pdev->kobj, KOBJ_ADD);
return p;
-out_free_info:
- kfree(p->info);
out_bdput:
bdput(bdev);
out_free: