summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/sysfs.c
diff options
context:
space:
mode:
authorAnand Jain <anand.jain@oracle.com>2019-11-21 17:33:34 +0800
committerDavid Sterba <dsterba@suse.com>2020-01-20 16:40:50 +0100
commitbc036bb33524dcb2525d74c336e9694d5d3c0047 (patch)
treefc4f8180e0c32d8ea7929e48da193e5b5bb95463 /fs/btrfs/sysfs.c
parentbe2cf92e0a2f64efe0709a2cfe5d9f4852d14b61 (diff)
downloadlinux-bc036bb33524dcb2525d74c336e9694d5d3c0047.tar.bz2
btrfs: sysfs, merge btrfs_sysfs_add devices_kobj and fsid
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>
Diffstat (limited to 'fs/btrfs/sysfs.c')
-rw-r--r--fs/btrfs/sysfs.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index c76c38d74972..16379f491ca1 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -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;
}