OSDN Git Service

btrfs: factor out sysfs code for sending device uevent
authorDavid Sterba <dsterba@suse.com>
Thu, 1 Aug 2019 16:50:16 +0000 (18:50 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 9 Sep 2019 12:59:07 +0000 (14:59 +0200)
The device uevent belongs to the sysfs API.

Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/sysfs.c
fs/btrfs/sysfs.h
fs/btrfs/volumes.c

index c7c29e5..5562ce1 100644 (file)
@@ -913,6 +913,17 @@ int btrfs_sysfs_add_device_link(struct btrfs_fs_devices *fs_devices,
        return error;
 }
 
+void btrfs_kobject_uevent(struct block_device *bdev, enum kobject_action action)
+{
+       int ret;
+
+       ret = kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, action);
+       if (ret)
+               pr_warn("BTRFS: Sending event '%d' to kobject: '%s' (%p): failed\n",
+                       action, kobject_name(&disk_to_dev(bdev->bd_disk)->kobj),
+                       &disk_to_dev(bdev->bd_disk)->kobj);
+}
+
 /* /sys/fs/btrfs/ entry */
 static struct kset *btrfs_kset;
 
index d8a6ab1..6807d10 100644 (file)
@@ -89,6 +89,7 @@ int btrfs_sysfs_add_device(struct btrfs_fs_devices *fs_devs);
 void btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs);
 void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info,
                u64 bit, enum btrfs_feature_set set);
+void btrfs_kobject_uevent(struct block_device *bdev, enum kobject_action action);
 
 int __init btrfs_init_sysfs(void);
 void __cold btrfs_exit_sysfs(void);
index 8031b47..830e4b0 100644 (file)
@@ -358,19 +358,6 @@ static void free_fs_devices(struct btrfs_fs_devices *fs_devices)
        kfree(fs_devices);
 }
 
-static void btrfs_kobject_uevent(struct block_device *bdev,
-                                enum kobject_action action)
-{
-       int ret;
-
-       ret = kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, action);
-       if (ret)
-               pr_warn("BTRFS: Sending event '%d' to kobject: '%s' (%p): failed\n",
-                       action,
-                       kobject_name(&disk_to_dev(bdev->bd_disk)->kobj),
-                       &disk_to_dev(bdev->bd_disk)->kobj);
-}
-
 void __exit btrfs_cleanup_fs_uuids(void)
 {
        struct btrfs_fs_devices *fs_devices;