diff options
author | Anand Jain <Anand.Jain@oracle.com> | 2015-03-10 06:38:27 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2015-05-27 12:27:20 +0200 |
commit | 0dd2906f7229186424cdc80be8654b2c21d9c04c (patch) | |
tree | 6a3a4384f995c82f74d7cbcfdb4a4f25c170e232 /fs/btrfs/sysfs.c | |
parent | 720592157eeef627ff9a7c7c55ab1713bc48fb50 (diff) | |
download | lwn-0dd2906f7229186424cdc80be8654b2c21d9c04c.tar.gz lwn-0dd2906f7229186424cdc80be8654b2c21d9c04c.zip |
Btrfs: sysfs: let default_attrs be separate from the kset
As of now btrfs_attrs are provided using the default_attrs through
the kset. Separate them and create the default_attrs using the
sysfs_create_files instead. By doing this we will have the
flexibility that device discovery thread could create fsid
kobject.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'fs/btrfs/sysfs.c')
-rw-r--r-- | fs/btrfs/sysfs.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index 83c0c5d5368b..11fa8e6c533c 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -428,7 +428,7 @@ static ssize_t btrfs_clone_alignment_show(struct kobject *kobj, BTRFS_ATTR(clone_alignment, btrfs_clone_alignment_show); -static struct attribute *btrfs_attrs[] = { +static const struct attribute *btrfs_attrs[] = { BTRFS_ATTR_PTR(label), BTRFS_ATTR_PTR(nodesize), BTRFS_ATTR_PTR(sectorsize), @@ -447,7 +447,6 @@ static void btrfs_release_super_kobj(struct kobject *kobj) static struct kobj_type btrfs_ktype = { .sysfs_ops = &kobj_sysfs_ops, .release = btrfs_release_super_kobj, - .default_attrs = btrfs_attrs, }; static inline struct btrfs_fs_info *to_fs_info(struct kobject *kobj) @@ -531,6 +530,7 @@ void btrfs_sysfs_remove_one(struct btrfs_fs_info *fs_info) } addrm_unknown_feature_attrs(fs_info, false); sysfs_remove_group(&fs_info->super_kobj, &btrfs_feature_attr_group); + sysfs_remove_files(&fs_info->super_kobj, btrfs_attrs); btrfs_sysfs_remove_fsid(fs_info); } @@ -720,13 +720,17 @@ int btrfs_sysfs_add_one(struct btrfs_fs_info *fs_info) return error; } - error = sysfs_create_group(&fs_info->super_kobj, - &btrfs_feature_attr_group); + error = sysfs_create_files(&fs_info->super_kobj, btrfs_attrs); if (error) { btrfs_sysfs_remove_fsid(fs_info); return error; } + error = sysfs_create_group(&fs_info->super_kobj, + &btrfs_feature_attr_group); + if (error) + goto failure; + error = addrm_unknown_feature_attrs(fs_info, true); if (error) goto failure; |