]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
btrfs: sysfs, merge btrfs_sysfs_add devices_kobj and fsid
authorAnand Jain <anand.jain@oracle.com>
Thu, 21 Nov 2019 09:33:34 +0000 (17:33 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 20 Jan 2020 15:40:50 +0000 (16:40 +0100)
Merge btrfs_sysfs_add_fsid() and btrfs_sysfs_add_devices_kobj() functions
as these two are small and they are called one after the other.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c
fs/btrfs/sysfs.c
fs/btrfs/sysfs.h

index 65cfd0fd0f832a83e7d7b5211efde2f886c028b2..ab888d89d844c2b3b6c33ec32b4e0f42e75f4f47 100644 (file)
@@ -3089,13 +3089,6 @@ int __cold open_ctree(struct super_block *sb,
                goto fail_block_groups;
        }
 
-       ret = btrfs_sysfs_add_devices_kobj(fs_devices);
-       if (ret) {
-               btrfs_err(fs_info, "failed to init sysfs device interface: %d",
-                               ret);
-               goto fail_fsdev_sysfs;
-       }
-
        ret = btrfs_sysfs_add_mounted(fs_info);
        if (ret) {
                btrfs_err(fs_info, "failed to init sysfs interface: %d", ret);
index c76c38d749724bf29eb074e64c9ae1599995dabe..16379f491ca1db5523eac50c32cf23faafc33b11 100644 (file)
@@ -995,18 +995,6 @@ int btrfs_sysfs_rm_device_link(struct btrfs_fs_devices *fs_devices,
        return 0;
 }
 
-int btrfs_sysfs_add_devices_kobj(struct btrfs_fs_devices *fs_devs)
-{
-       if (!fs_devs->devices_kobj)
-               fs_devs->devices_kobj = kobject_create_and_add("devices",
-                                                       &fs_devs->fsid_kobj);
-
-       if (!fs_devs->devices_kobj)
-               return -ENOMEM;
-
-       return 0;
-}
-
 int btrfs_sysfs_add_device_link(struct btrfs_fs_devices *fs_devices,
                                struct btrfs_device *one_device)
 {
@@ -1083,6 +1071,15 @@ int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs)
                return error;
        }
 
+       fs_devs->devices_kobj = kobject_create_and_add("devices",
+                                                      &fs_devs->fsid_kobj);
+       if (!fs_devs->devices_kobj) {
+               btrfs_err(fs_devs->fs_info,
+                         "failed to init sysfs device interface");
+               kobject_put(&fs_devs->fsid_kobj);
+               return -ENOMEM;
+       }
+
        return 0;
 }
 
index a0454947f41a28c2191d658a9c029f3a643e1aed..3d27b39eaf9459fbd1e32c8b87ee631752081109 100644 (file)
@@ -19,7 +19,6 @@ int btrfs_sysfs_add_device_link(struct btrfs_fs_devices *fs_devices,
 int btrfs_sysfs_rm_device_link(struct btrfs_fs_devices *fs_devices,
                 struct btrfs_device *one_device);
 int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs);
-int btrfs_sysfs_add_devices_kobj(struct btrfs_fs_devices *fs_devs);
 void btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs);
 void btrfs_sysfs_update_sprout_fsid(struct btrfs_fs_devices *fs_devices,
                                    const u8 *fsid);