Commit f3cd2c58 authored by Anand Jain's avatar Anand Jain Committed by David Sterba

btrfs: sysfs, rename device_link add/remove functions

Since commit 668e48af ("btrfs: sysfs, add devid/dev_state kobject and
device attributes"), the functions btrfs_sysfs_add_device_link() and
btrfs_sysfs_rm_device_link() do more than just adding and removing the
device link as its name indicated. Rename them to be more specific
that's about the directory with the attirbutes
Signed-off-by: default avatarAnand Jain <anand.jain@oracle.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 1f6087e6
...@@ -512,7 +512,7 @@ static int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info, ...@@ -512,7 +512,7 @@ static int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info,
atomic64_set(&dev_replace->num_uncorrectable_read_errors, 0); atomic64_set(&dev_replace->num_uncorrectable_read_errors, 0);
up_write(&dev_replace->rwsem); up_write(&dev_replace->rwsem);
ret = btrfs_sysfs_add_device_link(tgt_device->fs_devices, tgt_device); ret = btrfs_sysfs_add_devices_dir(tgt_device->fs_devices, tgt_device);
if (ret) if (ret)
btrfs_err(fs_info, "kobj add dev failed %d", ret); btrfs_err(fs_info, "kobj add dev failed %d", ret);
...@@ -743,7 +743,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, ...@@ -743,7 +743,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
mutex_unlock(&fs_info->fs_devices->device_list_mutex); mutex_unlock(&fs_info->fs_devices->device_list_mutex);
/* replace the sysfs entry */ /* replace the sysfs entry */
btrfs_sysfs_rm_device_link(fs_info->fs_devices, src_device); btrfs_sysfs_remove_devices_dir(fs_info->fs_devices, src_device);
btrfs_sysfs_update_devid(tgt_device); btrfs_sysfs_update_devid(tgt_device);
btrfs_rm_dev_replace_free_srcdev(src_device); btrfs_rm_dev_replace_free_srcdev(src_device);
......
...@@ -960,7 +960,7 @@ void btrfs_sysfs_remove_mounted(struct btrfs_fs_info *fs_info) ...@@ -960,7 +960,7 @@ void btrfs_sysfs_remove_mounted(struct btrfs_fs_info *fs_info)
addrm_unknown_feature_attrs(fs_info, false); addrm_unknown_feature_attrs(fs_info, false);
sysfs_remove_group(&fs_info->fs_devices->fsid_kobj, &btrfs_feature_attr_group); 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_files(&fs_info->fs_devices->fsid_kobj, btrfs_attrs);
btrfs_sysfs_rm_device_link(fs_info->fs_devices, NULL); btrfs_sysfs_remove_devices_dir(fs_info->fs_devices, NULL);
} }
static const char * const btrfs_feature_set_names[FEAT_MAX] = { static const char * const btrfs_feature_set_names[FEAT_MAX] = {
...@@ -1149,7 +1149,7 @@ int btrfs_sysfs_add_space_info_type(struct btrfs_fs_info *fs_info, ...@@ -1149,7 +1149,7 @@ int btrfs_sysfs_add_space_info_type(struct btrfs_fs_info *fs_info,
/* when one_device is NULL, it removes all device links */ /* when one_device is NULL, it removes all device links */
int btrfs_sysfs_rm_device_link(struct btrfs_fs_devices *fs_devices, int btrfs_sysfs_remove_devices_dir(struct btrfs_fs_devices *fs_devices,
struct btrfs_device *one_device) struct btrfs_device *one_device)
{ {
struct hd_struct *disk; struct hd_struct *disk;
...@@ -1269,7 +1269,7 @@ static struct kobj_type devid_ktype = { ...@@ -1269,7 +1269,7 @@ static struct kobj_type devid_ktype = {
.release = btrfs_release_devid_kobj, .release = btrfs_release_devid_kobj,
}; };
int btrfs_sysfs_add_device_link(struct btrfs_fs_devices *fs_devices, int btrfs_sysfs_add_devices_dir(struct btrfs_fs_devices *fs_devices,
struct btrfs_device *one_device) struct btrfs_device *one_device)
{ {
int error = 0; int error = 0;
...@@ -1395,13 +1395,13 @@ int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info) ...@@ -1395,13 +1395,13 @@ int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info)
btrfs_set_fs_info_ptr(fs_info); btrfs_set_fs_info_ptr(fs_info);
error = btrfs_sysfs_add_device_link(fs_devs, NULL); error = btrfs_sysfs_add_devices_dir(fs_devs, NULL);
if (error) if (error)
return error; return error;
error = sysfs_create_files(fsid_kobj, btrfs_attrs); error = sysfs_create_files(fsid_kobj, btrfs_attrs);
if (error) { if (error) {
btrfs_sysfs_rm_device_link(fs_devs, NULL); btrfs_sysfs_remove_devices_dir(fs_devs, NULL);
return error; return error;
} }
......
...@@ -14,9 +14,9 @@ enum btrfs_feature_set { ...@@ -14,9 +14,9 @@ enum btrfs_feature_set {
char *btrfs_printable_features(enum btrfs_feature_set set, u64 flags); char *btrfs_printable_features(enum btrfs_feature_set set, u64 flags);
const char * const btrfs_feature_set_name(enum btrfs_feature_set set); const char * const btrfs_feature_set_name(enum btrfs_feature_set set);
int btrfs_sysfs_add_device_link(struct btrfs_fs_devices *fs_devices, int btrfs_sysfs_add_devices_dir(struct btrfs_fs_devices *fs_devices,
struct btrfs_device *one_device); struct btrfs_device *one_device);
int btrfs_sysfs_rm_device_link(struct btrfs_fs_devices *fs_devices, int btrfs_sysfs_remove_devices_dir(struct btrfs_fs_devices *fs_devices,
struct btrfs_device *one_device); struct btrfs_device *one_device);
int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs); int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs);
void btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs); void btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs);
......
...@@ -2054,7 +2054,7 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path, ...@@ -2054,7 +2054,7 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path,
if (device->bdev) { if (device->bdev) {
cur_devices->open_devices--; cur_devices->open_devices--;
/* remove sysfs entry */ /* remove sysfs entry */
btrfs_sysfs_rm_device_link(fs_devices, device); btrfs_sysfs_remove_devices_dir(fs_devices, device);
} }
num_devices = btrfs_super_num_devices(fs_info->super_copy) - 1; num_devices = btrfs_super_num_devices(fs_info->super_copy) - 1;
...@@ -2174,7 +2174,7 @@ void btrfs_destroy_dev_replace_tgtdev(struct btrfs_device *tgtdev) ...@@ -2174,7 +2174,7 @@ void btrfs_destroy_dev_replace_tgtdev(struct btrfs_device *tgtdev)
mutex_lock(&fs_devices->device_list_mutex); mutex_lock(&fs_devices->device_list_mutex);
btrfs_sysfs_rm_device_link(fs_devices, tgtdev); btrfs_sysfs_remove_devices_dir(fs_devices, tgtdev);
if (tgtdev->bdev) if (tgtdev->bdev)
fs_devices->open_devices--; fs_devices->open_devices--;
...@@ -2522,7 +2522,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path ...@@ -2522,7 +2522,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
orig_super_num_devices + 1); orig_super_num_devices + 1);
/* add sysfs device entry */ /* add sysfs device entry */
btrfs_sysfs_add_device_link(fs_devices, device); btrfs_sysfs_add_devices_dir(fs_devices, device);
/* /*
* we've got more storage, clear any full flags on the space * we've got more storage, clear any full flags on the space
...@@ -2590,7 +2590,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path ...@@ -2590,7 +2590,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
return ret; return ret;
error_sysfs: error_sysfs:
btrfs_sysfs_rm_device_link(fs_devices, device); btrfs_sysfs_remove_devices_dir(fs_devices, device);
mutex_lock(&fs_info->fs_devices->device_list_mutex); mutex_lock(&fs_info->fs_devices->device_list_mutex);
mutex_lock(&fs_info->chunk_mutex); mutex_lock(&fs_info->chunk_mutex);
list_del_rcu(&device->dev_list); list_del_rcu(&device->dev_list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment