提交 bc036bb3 编写于 作者: A Anand Jain 提交者: David Sterba

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: NAnand Jain <anand.jain@oracle.com>
Reviewed-by: NDavid Sterba <dsterba@suse.com>
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 be2cf92e
......@@ -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);
......
......@@ -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;
}
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册