diff mbox series

[12/15] btrfs: sysfs, unexport btrfs_sysfs_add_mounted()

Message ID 20191118084656.3089-13-anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series btrfs: sysfs, cleanups | expand

Commit Message

Anand Jain Nov. 18, 2019, 8:46 a.m. UTC
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(-)
diff mbox series

Patch

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 85ec0a3d2019..8f6a08bef490 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -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:
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 806676ef008a..2ea27c2d9ef1 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -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;
 }
 
diff --git a/fs/btrfs/sysfs.h b/fs/btrfs/sysfs.h
index 0648afbb40ca..a977fe3bec64 100644
--- a/fs/btrfs/sysfs.h
+++ b/fs/btrfs/sysfs.h
@@ -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,