Skip to content

Commit

Permalink
btrfs: sysfs, rename devices kobject holder to devices_kobj
Browse files Browse the repository at this point in the history
The struct member btrfs_device::device_dir_kobj holds the kobj of the
sysfs directory /sys/fs/btrfs/UUID/devices, so rename it from
device_dir_kobj to devices_kobj. No functional changes.

Signed-off-by: Anand Jain <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: David Sterba <[email protected]>
  • Loading branch information
asj authored and kdave committed Jan 20, 2020
1 parent db26a02 commit b550150
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
26 changes: 12 additions & 14 deletions fs/btrfs/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,10 +734,10 @@ static int addrm_unknown_feature_attrs(struct btrfs_fs_info *fs_info, bool add)

static void __btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs)
{
if (fs_devs->device_dir_kobj) {
kobject_del(fs_devs->device_dir_kobj);
kobject_put(fs_devs->device_dir_kobj);
fs_devs->device_dir_kobj = NULL;
if (fs_devs->devices_kobj) {
kobject_del(fs_devs->devices_kobj);
kobject_put(fs_devs->devices_kobj);
fs_devs->devices_kobj = NULL;
}

if (fs_devs->fsid_kobj.state_initialized) {
Expand Down Expand Up @@ -969,15 +969,14 @@ int btrfs_sysfs_rm_device_link(struct btrfs_fs_devices *fs_devices,
struct hd_struct *disk;
struct kobject *disk_kobj;

if (!fs_devices->device_dir_kobj)
if (!fs_devices->devices_kobj)
return -EINVAL;

if (one_device && one_device->bdev) {
disk = one_device->bdev->bd_part;
disk_kobj = &part_to_dev(disk)->kobj;

sysfs_remove_link(fs_devices->device_dir_kobj,
disk_kobj->name);
sysfs_remove_link(fs_devices->devices_kobj, disk_kobj->name);
}

if (one_device)
Expand All @@ -990,20 +989,19 @@ int btrfs_sysfs_rm_device_link(struct btrfs_fs_devices *fs_devices,
disk = one_device->bdev->bd_part;
disk_kobj = &part_to_dev(disk)->kobj;

sysfs_remove_link(fs_devices->device_dir_kobj,
disk_kobj->name);
sysfs_remove_link(fs_devices->devices_kobj, disk_kobj->name);
}

return 0;
}

int btrfs_sysfs_add_device(struct btrfs_fs_devices *fs_devs)
{
if (!fs_devs->device_dir_kobj)
fs_devs->device_dir_kobj = kobject_create_and_add("devices",
&fs_devs->fsid_kobj);
if (!fs_devs->devices_kobj)
fs_devs->devices_kobj = kobject_create_and_add("devices",
&fs_devs->fsid_kobj);

if (!fs_devs->device_dir_kobj)
if (!fs_devs->devices_kobj)
return -ENOMEM;

return 0;
Expand All @@ -1028,7 +1026,7 @@ int btrfs_sysfs_add_device_link(struct btrfs_fs_devices *fs_devices,
disk = dev->bdev->bd_part;
disk_kobj = &part_to_dev(disk)->kobj;

error = sysfs_create_link(fs_devices->device_dir_kobj,
error = sysfs_create_link(fs_devices->devices_kobj,
disk_kobj, disk_kobj->name);
if (error)
break;
Expand Down
2 changes: 1 addition & 1 deletion fs/btrfs/volumes.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ struct btrfs_fs_devices {
struct btrfs_fs_info *fs_info;
/* sysfs kobjects */
struct kobject fsid_kobj;
struct kobject *device_dir_kobj;
struct kobject *devices_kobj;
struct completion kobj_unregister;
};

Expand Down

0 comments on commit b550150

Please sign in to comment.