diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index b2e8fd8a8e59..94446ed7a872 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -739,6 +739,8 @@ struct btrfs_fs_info {
 	struct task_struct *cleaner_kthread;
 	u32 thread_pool_size;
 
+	/* sysfs kobjects */
+	struct kobject fsid_kobj;
 	struct kobject *space_info_kobj;
 
 	u64 total_pinned;
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index ab888d89d844..85ec0a3d2019 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3082,10 +3082,10 @@ int __cold open_ctree(struct super_block *sb,
 
 	btrfs_free_extra_devids(fs_devices, 1);
 
-	ret = btrfs_sysfs_add_fsid(fs_devices);
+	ret = btrfs_sysfs_add_fsid(fs_info);
 	if (ret) {
 		btrfs_err(fs_info, "failed to init sysfs fsid interface: %d",
-				ret);
+			  ret);
 		goto fail_block_groups;
 	}
 
@@ -3308,7 +3308,7 @@ int __cold open_ctree(struct super_block *sb,
 	btrfs_sysfs_remove_mounted(fs_info);
 
 fail_fsdev_sysfs:
-	btrfs_sysfs_remove_fsid(fs_info->fs_devices);
+	btrfs_sysfs_remove_fsid(fs_info);
 
 fail_block_groups:
 	btrfs_put_block_group_cache(fs_info);
@@ -4006,7 +4006,7 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
 			   percpu_counter_sum(&fs_info->dio_bytes));
 
 	btrfs_sysfs_remove_mounted(fs_info);
-	btrfs_sysfs_remove_fsid(fs_info->fs_devices);
+	btrfs_sysfs_remove_fsid(fs_info);
 
 	btrfs_free_fs_roots(fs_info);
 
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index b42245104bc9..806676ef008a 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -62,7 +62,6 @@ static struct btrfs_feature_attr btrfs_attr_features_##_name = {	     \
 	BTRFS_FEAT_ATTR(name, FEAT_INCOMPAT, BTRFS_FEATURE_INCOMPAT, feature)
 
 static inline struct btrfs_fs_info *to_fs_info(struct kobject *kobj);
-static inline struct btrfs_fs_devices *to_fs_devs(struct kobject *kobj);
 
 static struct btrfs_feature_attr *to_btrfs_feature_attr(struct kobj_attribute *a)
 {
@@ -655,10 +654,10 @@ static const struct attribute *btrfs_attrs[] = {
 
 static void btrfs_release_fsid_kobj(struct kobject *kobj)
 {
-	struct btrfs_fs_devices *fs_devs = to_fs_devs(kobj);
+	struct btrfs_fs_info *fs_info = to_fs_info(kobj);
 
-	memset(&fs_devs->fsid_kobj, 0, sizeof(struct kobject));
-	complete(&fs_devs->kobj_unregister);
+	memset(&fs_info->fsid_kobj, 0, sizeof(struct kobject));
+	complete(&fs_info->fs_devices->kobj_unregister);
 }
 
 static struct kobj_type btrfs_ktype = {
@@ -666,18 +665,11 @@ static struct kobj_type btrfs_ktype = {
 	.release	= btrfs_release_fsid_kobj,
 };
 
-static inline struct btrfs_fs_devices *to_fs_devs(struct kobject *kobj)
-{
-	if (kobj->ktype != &btrfs_ktype)
-		return NULL;
-	return container_of(kobj, struct btrfs_fs_devices, fsid_kobj);
-}
-
 static inline struct btrfs_fs_info *to_fs_info(struct kobject *kobj)
 {
 	if (kobj->ktype != &btrfs_ktype)
 		return NULL;
-	return to_fs_devs(kobj)->fs_info;
+	return container_of(kobj, struct btrfs_fs_info, fsid_kobj);
 }
 
 #define NUM_FEATURE_BITS 64
@@ -719,12 +711,12 @@ static int addrm_unknown_feature_attrs(struct btrfs_fs_info *fs_info, bool add)
 			attrs[0] = &fa->kobj_attr.attr;
 			if (add) {
 				int ret;
-				ret = sysfs_merge_group(&fs_info->fs_devices->fsid_kobj,
+				ret = sysfs_merge_group(&fs_info->fsid_kobj,
 							&agroup);
 				if (ret)
 					return ret;
 			} else
-				sysfs_unmerge_group(&fs_info->fs_devices->fsid_kobj,
+				sysfs_unmerge_group(&fs_info->fsid_kobj,
 						    &agroup);
 		}
 
@@ -1001,8 +993,8 @@ void btrfs_sysfs_remove_mounted(struct btrfs_fs_info *fs_info)
 		kobject_put(fs_info->space_info_kobj);
 	}
 	addrm_unknown_feature_attrs(fs_info, false);
-	sysfs_remove_group(&fs_info->fs_devices->fsid_kobj, &btrfs_feature_attr_group);
-	sysfs_remove_files(&fs_info->fs_devices->fsid_kobj, btrfs_attrs);
+	sysfs_remove_group(&fs_info->fsid_kobj, &btrfs_feature_attr_group);
+	sysfs_remove_files(&fs_info->fsid_kobj, btrfs_attrs);
 	btrfs_sysfs_remove_device_info(fs_info->fs_devices, NULL);
 }
 
@@ -1010,7 +1002,7 @@ int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info)
 {
 	int error;
 	struct btrfs_fs_devices *fs_devs = fs_info->fs_devices;
-	struct kobject *fsid_kobj = &fs_devs->fsid_kobj;
+	struct kobject *fsid_kobj = &fs_info->fsid_kobj;
 
 	btrfs_set_fs_info_ptr(fs_info);
 
@@ -1067,41 +1059,47 @@ void btrfs_sysfs_update_sprout_fsid(struct btrfs_fs_devices *fs_devices,
 	 * directory
 	 */
 	snprintf(fsid_buf, BTRFS_UUID_UNPARSED_SIZE, "%pU", fsid);
-	if (kobject_rename(&fs_devices->fsid_kobj, fsid_buf))
+	if (kobject_rename(&fs_devices->fs_info->fsid_kobj, fsid_buf))
 		btrfs_warn(fs_devices->fs_info,
-				"sysfs: failed to create fsid for sprout");
+			   "sysfs: failed to create fsid for sprout");
 }
 
 /* /sys/fs/btrfs/ entry */
 static struct kset *btrfs_kset;
 
-static void __btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs)
+/*
+ * Remove /sys/fs/btrfs/UUID/devices and /sysfs/btrfs/UUID
+ */
+static void __btrfs_sysfs_remove_fsid(struct btrfs_fs_info *fs_info)
 {
-	if (fs_devs->devices_dir_kobj) {
-		kobject_del(fs_devs->devices_dir_kobj);
-		kobject_put(fs_devs->devices_dir_kobj);
-		fs_devs->devices_dir_kobj = NULL;
+	struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
+
+	if (fs_devices->devices_dir_kobj) {
+		kobject_del(fs_devices->devices_dir_kobj);
+		kobject_put(fs_devices->devices_dir_kobj);
+		fs_devices->devices_dir_kobj = NULL;
 	}
 
-	if (fs_devs->fsid_kobj.state_initialized) {
-		kobject_del(&fs_devs->fsid_kobj);
-		kobject_put(&fs_devs->fsid_kobj);
-		wait_for_completion(&fs_devs->kobj_unregister);
+	if (fs_info->fsid_kobj.state_initialized) {
+		kobject_del(&fs_info->fsid_kobj);
+		kobject_put(&fs_info->fsid_kobj);
+		wait_for_completion(&fs_devices->kobj_unregister);
 	}
 }
 
-/* when fs_devs is NULL it will remove all fsid kobject */
-void btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs)
+/* when fs_info is NULL it will remove all fs_info::fsid kobject */
+void btrfs_sysfs_remove_fsid(struct btrfs_fs_info *fs_info)
 {
 	struct list_head *fs_uuids = btrfs_get_fs_uuids();
+	struct btrfs_fs_devices *fs_devices;
 
-	if (fs_devs) {
-		__btrfs_sysfs_remove_fsid(fs_devs);
+	if (fs_info) {
+		__btrfs_sysfs_remove_fsid(fs_info);
 		return;
 	}
 
-	list_for_each_entry(fs_devs, fs_uuids, fs_list) {
-		__btrfs_sysfs_remove_fsid(fs_devs);
+	list_for_each_entry(fs_devices, fs_uuids, fs_list) {
+		__btrfs_sysfs_remove_fsid(fs_devices->fs_info);
 	}
 }
 
@@ -1109,25 +1107,25 @@ void btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs)
  * Creates:
  * 	/sys/fs/btrfs/UUID
  */
-int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs)
+int btrfs_sysfs_add_fsid(struct btrfs_fs_info *fs_info)
 {
 	int error;
+	struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
 
-	init_completion(&fs_devs->kobj_unregister);
-	fs_devs->fsid_kobj.kset = btrfs_kset;
-	error = kobject_init_and_add(&fs_devs->fsid_kobj, &btrfs_ktype, NULL,
-				     "%pU", fs_devs->fsid);
+	init_completion(&fs_devices->kobj_unregister);
+	fs_info->fsid_kobj.kset = btrfs_kset;
+	error = kobject_init_and_add(&fs_info->fsid_kobj, &btrfs_ktype, NULL,
+				     "%pU", fs_devices->fsid);
 	if (error) {
-		kobject_put(&fs_devs->fsid_kobj);
+		kobject_put(&fs_info->fsid_kobj);
 		return error;
 	}
 
-	fs_devs->devices_dir_kobj = kobject_create_and_add("devices",
-							&fs_devs->fsid_kobj);
-	if (!fs_devs->devices_dir_kobj) {
-		btrfs_err(fs_devs->fs_info,
-			  "failed to init sysfs device interface");
-		kobject_put(&fs_devs->fsid_kobj);
+	fs_devices->devices_dir_kobj = kobject_create_and_add("devices",
+							&fs_info->fsid_kobj);
+	if (!fs_devices->devices_dir_kobj) {
+		btrfs_err(fs_info, "failed to init sysfs device interface");
+		kobject_put(&fs_info->fsid_kobj);
 		return -ENOMEM;
 	}
 
@@ -1141,7 +1139,6 @@ int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs)
 void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info,
 		u64 bit, enum btrfs_feature_set set)
 {
-	struct btrfs_fs_devices *fs_devs;
 	struct kobject *fsid_kobj;
 	u64 features;
 	int ret;
@@ -1152,8 +1149,7 @@ void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info,
 	features = get_features(fs_info, set);
 	ASSERT(bit & supported_feature_masks[set]);
 
-	fs_devs = fs_info->fs_devices;
-	fsid_kobj = &fs_devs->fsid_kobj;
+	fsid_kobj = &fs_info->fsid_kobj;
 
 	if (!fsid_kobj->state_initialized)
 		return;
diff --git a/fs/btrfs/sysfs.h b/fs/btrfs/sysfs.h
index e7ae91f68e36..0648afbb40ca 100644
--- a/fs/btrfs/sysfs.h
+++ b/fs/btrfs/sysfs.h
@@ -18,8 +18,8 @@ int btrfs_sysfs_add_device_info(struct btrfs_fs_devices *fs_devices,
 		struct btrfs_device *one_device);
 int btrfs_sysfs_remove_device_info(struct btrfs_fs_devices *fs_devices,
                 struct btrfs_device *one_device);
-int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs);
-void btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs);
+int btrfs_sysfs_add_fsid(struct btrfs_fs_info *fs_info);
+void btrfs_sysfs_remove_fsid(struct btrfs_fs_info *fs_info);
 void btrfs_sysfs_update_sprout_fsid(struct btrfs_fs_devices *fs_devices,
 				    const u8 *fsid);
 void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info,
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 012e75f29fe0..3fd7f2b348b0 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -254,9 +254,8 @@ struct btrfs_fs_devices {
 
 	struct btrfs_fs_info *fs_info;
 	/* sysfs kobjects */
-	struct kobject fsid_kobj;
-	struct kobject *devices_dir_kobj;
 	struct completion kobj_unregister;
+	struct kobject *devices_dir_kobj;
 };
 
 #define BTRFS_BIO_INLINE_CSUM_SIZE	64
