@@ -3089,12 +3089,6 @@ int __cold open_ctree(struct super_block *sb,
goto fail_block_groups;
}
- ret = btrfs_sysfs_add_mounted(fs_info);
- if (ret) {
- btrfs_err(fs_info, "failed to init sysfs interface: %d", ret);
- goto fail_fsdev_sysfs;
- }
-
ret = btrfs_init_space_info(fs_info);
if (ret) {
btrfs_err(fs_info, "failed to initialize space info: %d", ret);
@@ -3306,8 +3300,6 @@ int __cold open_ctree(struct super_block *sb,
fail_sysfs:
btrfs_sysfs_remove_mounted(fs_info);
-
-fail_fsdev_sysfs:
btrfs_sysfs_remove_fsid(fs_info);
fail_block_groups:
@@ -998,7 +998,7 @@ void btrfs_sysfs_remove_mounted(struct btrfs_fs_info *fs_info)
btrfs_sysfs_remove_device_info(fs_info->fs_devices, NULL);
}
-int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info)
+static int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info)
{
int error;
struct btrfs_fs_devices *fs_devs = fs_info->fs_devices;
@@ -1129,6 +1129,13 @@ int btrfs_sysfs_add_fsid(struct btrfs_fs_info *fs_info)
return -ENOMEM;
}
+ error = btrfs_sysfs_add_mounted(fs_info);
+ if (error) {
+ btrfs_err(fs_info, "failed to init sysfs interface: %d", error);
+ btrfs_sysfs_remove_fsid(fs_info);
+ return error;
+ }
+
return 0;
}
@@ -28,7 +28,6 @@ void btrfs_kobject_uevent(struct block_device *bdev, enum kobject_action action)
int __init btrfs_init_sysfs(void);
void __cold btrfs_exit_sysfs(void);
-int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info);
void btrfs_sysfs_remove_mounted(struct btrfs_fs_info *fs_info);
void btrfs_sysfs_add_block_group_type(struct btrfs_block_group *cache);
int btrfs_sysfs_add_space_info_type(struct btrfs_fs_info *fs_info,
In open_ctree() we call btrfs_sysfs_add_fsid() to create /sys/fs/btrfs/UUID kobject, and in the following line of code in open_ctree() we call btrfs_sysfs_add_mounted() to create its attributes. And there is no other users of btrfs_sysfs_add_mounted(). So let btrfs_sysfs_add_fsid() also create its attributes and make btrfs_sysfs_add_mounted() a local static function. Signed-off-by: Anand Jain <anand.jain@oracle.com> --- fs/btrfs/disk-io.c | 8 -------- fs/btrfs/sysfs.c | 9 ++++++++- fs/btrfs/sysfs.h | 1 - 3 files changed, 8 insertions(+), 10 deletions(-)