Commit 231926db authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 29ff57c6
...@@ -381,7 +381,6 @@ static inline void hd_struct_put(struct hd_struct *part) ...@@ -381,7 +381,6 @@ static inline void hd_struct_put(struct hd_struct *part)
static inline void hd_free_part(struct hd_struct *part) static inline void hd_free_part(struct hd_struct *part)
{ {
kfree(part->info);
bdput(part->bdev); bdput(part->bdev);
percpu_ref_exit(&part->ref); percpu_ref_exit(&part->ref);
} }
......
...@@ -1010,7 +1010,8 @@ void __init printk_all_partitions(void) ...@@ -1010,7 +1010,8 @@ void __init printk_all_partitions(void)
bdevt_str(part_devt(part), devt_buf), bdevt_str(part_devt(part), devt_buf),
bdev_nr_sectors(part->bdev) >> 1, bdev_nr_sectors(part->bdev) >> 1,
disk_name(disk, part->partno, name_buf), 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 (is_part0) {
if (dev->parent && dev->parent->driver) if (dev->parent && dev->parent->driver)
printk(" driver: %s\n", printk(" driver: %s\n",
......
...@@ -275,8 +275,9 @@ static int part_uevent(struct device *dev, struct kobj_uevent_env *env) ...@@ -275,8 +275,9 @@ static int part_uevent(struct device *dev, struct kobj_uevent_env *env)
struct hd_struct *part = dev_to_part(dev); struct hd_struct *part = dev_to_part(dev);
add_uevent_var(env, "PARTN=%u", part->partno); add_uevent_var(env, "PARTN=%u", part->partno);
if (part->info && part->info->volname[0]) if (part->bdev->bd_meta_info && part->bdev->bd_meta_info->volname[0])
add_uevent_var(env, "PARTNAME=%s", part->info->volname); add_uevent_var(env, "PARTNAME=%s",
part->bdev->bd_meta_info->volname);
return 0; return 0;
} }
...@@ -422,13 +423,10 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno, ...@@ -422,13 +423,10 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno,
p->policy = get_disk_ro(disk); p->policy = get_disk_ro(disk);
if (info) { if (info) {
struct partition_meta_info *pinfo; err = -ENOMEM;
bdev->bd_meta_info = kmemdup(info, sizeof(*info), GFP_KERNEL);
pinfo = kzalloc_node(sizeof(*pinfo), GFP_KERNEL, disk->node_id); if (!bdev->bd_meta_info)
if (!pinfo)
goto out_bdput; goto out_bdput;
memcpy(pinfo, info, sizeof(*info));
p->info = pinfo;
} }
dname = dev_name(ddev); dname = dev_name(ddev);
...@@ -444,7 +442,7 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno, ...@@ -444,7 +442,7 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno,
err = blk_alloc_devt(p, &devt); err = blk_alloc_devt(p, &devt);
if (err) if (err)
goto out_free_info; goto out_bdput;
pdev->devt = devt; pdev->devt = devt;
/* delay uevent until 'holders' subdir is created */ /* delay uevent until 'holders' subdir is created */
...@@ -481,8 +479,6 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno, ...@@ -481,8 +479,6 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno,
kobject_uevent(&pdev->kobj, KOBJ_ADD); kobject_uevent(&pdev->kobj, KOBJ_ADD);
return p; return p;
out_free_info:
kfree(p->info);
out_bdput: out_bdput:
bdput(bdev); bdput(bdev);
out_free: out_free:
......
...@@ -785,6 +785,7 @@ static void bdev_free_inode(struct inode *inode) ...@@ -785,6 +785,7 @@ static void bdev_free_inode(struct inode *inode)
struct block_device *bdev = I_BDEV(inode); struct block_device *bdev = I_BDEV(inode);
free_percpu(bdev->bd_stats); free_percpu(bdev->bd_stats);
kfree(bdev->bd_meta_info);
kmem_cache_free(bdev_cachep, BDEV_I(inode)); kmem_cache_free(bdev_cachep, BDEV_I(inode));
} }
......
...@@ -49,6 +49,8 @@ struct block_device { ...@@ -49,6 +49,8 @@ struct block_device {
/* Mutex for freeze */ /* Mutex for freeze */
struct mutex bd_fsfreeze_mutex; struct mutex bd_fsfreeze_mutex;
struct super_block *bd_fsfreeze_sb; struct super_block *bd_fsfreeze_sb;
struct partition_meta_info *bd_meta_info;
} __randomize_layout; } __randomize_layout;
#define bdev_whole(_bdev) \ #define bdev_whole(_bdev) \
......
...@@ -57,7 +57,6 @@ struct hd_struct { ...@@ -57,7 +57,6 @@ struct hd_struct {
struct device __dev; struct device __dev;
struct kobject *holder_dir; struct kobject *holder_dir;
int policy, partno; int policy, partno;
struct partition_meta_info *info;
#ifdef CONFIG_FAIL_MAKE_REQUEST #ifdef CONFIG_FAIL_MAKE_REQUEST
int make_it_fail; int make_it_fail;
#endif #endif
......
...@@ -79,8 +79,8 @@ static int match_dev_by_uuid(struct device *dev, const void *data) ...@@ -79,8 +79,8 @@ static int match_dev_by_uuid(struct device *dev, const void *data)
const struct uuidcmp *cmp = data; const struct uuidcmp *cmp = data;
struct hd_struct *part = dev_to_part(dev); struct hd_struct *part = dev_to_part(dev);
if (!part->info || if (!part->bdev->bd_meta_info ||
strncasecmp(cmp->uuid, part->info->uuid, cmp->len)) strncasecmp(cmp->uuid, part->bdev->bd_meta_info->uuid, cmp->len))
return 0; return 0;
return 1; return 1;
} }
...@@ -169,7 +169,8 @@ static int match_dev_by_label(struct device *dev, const void *data) ...@@ -169,7 +169,8 @@ static int match_dev_by_label(struct device *dev, const void *data)
const char *label = data; const char *label = data;
struct hd_struct *part = dev_to_part(dev); struct hd_struct *part = dev_to_part(dev);
if (!part->info || strcmp(label, part->info->volname)) if (!part->bdev->bd_meta_info ||
strcmp(label, part->bdev->bd_meta_info->volname))
return 0; return 0;
return 1; return 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment