]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
btrfs: rename btrfs_find_device_by_user_input
authorDavid Sterba <dsterba@suse.com>
Mon, 15 Feb 2016 15:39:55 +0000 (16:39 +0100)
committerDavid Sterba <dsterba@suse.com>
Fri, 26 Feb 2016 14:04:55 +0000 (15:04 +0100)
For clarity how we are going to find the device, let's call it a device
specifier, devspec for short. Also rename the arguments that are a
leftover from previous function purpose.

Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/dev-replace.c
fs/btrfs/volumes.c
fs/btrfs/volumes.h

index 3e2616d151d9203a29407e91dac979bb364e7211..1731f92b62472c92839e04afb6a99aeb5036a216 100644 (file)
@@ -322,7 +322,7 @@ int btrfs_dev_replace_start(struct btrfs_root *root,
 
        /* the disk copy procedure reuses the scrub code */
        mutex_lock(&fs_info->volume_mutex);
-       ret = btrfs_find_device_by_user_input(root, args->start.srcdevid,
+       ret = btrfs_find_device_by_devspec(root, args->start.srcdevid,
                                            args->start.srcdev_name,
                                            &src_device);
        if (ret) {
index 8fee24f92574534cf8c52de59d1470b74171fb28..05d9bc0cdd4954f550ed2ea18b4e756fe6345d98 100644 (file)
@@ -1779,7 +1779,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path, u64 devid)
        if (ret)
                goto out;
 
-       ret = btrfs_find_device_by_user_input(root, devid, device_path,
+       ret = btrfs_find_device_by_devspec(root, devid, device_path,
                                &device);
        if (ret)
                goto out;
@@ -2065,23 +2065,26 @@ int btrfs_find_device_missing_or_by_path(struct btrfs_root *root,
        }
 }
 
-int btrfs_find_device_by_user_input(struct btrfs_root *root, u64 srcdevid,
-                                        char *srcdev_name,
+/*
+ * Lookup a device given by device id, or the path if the id is 0.
+ */
+int btrfs_find_device_by_devspec(struct btrfs_root *root, u64 devid,
+                                        char *devpath,
                                         struct btrfs_device **device)
 {
        int ret;
 
-       if (srcdevid) {
+       if (devid) {
                ret = 0;
-               *device = btrfs_find_device(root->fs_info, srcdevid, NULL,
+               *device = btrfs_find_device(root->fs_info, devid, NULL,
                                            NULL);
                if (!*device)
                        ret = -ENOENT;
        } else {
-               if (!srcdev_name || !srcdev_name[0])
+               if (!devpath || !devpath[0])
                        return -EINVAL;
 
-               ret = btrfs_find_device_missing_or_by_path(root, srcdev_name,
+               ret = btrfs_find_device_missing_or_by_path(root, devpath,
                                                           device);
        }
        return ret;
index a13a538cb01e91089cd733980e0f13e29931f446..febdb7bc93704bae06d809bca5068a5f60ca5375 100644 (file)
@@ -448,8 +448,8 @@ void btrfs_close_extra_devices(struct btrfs_fs_devices *fs_devices, int step);
 int btrfs_find_device_missing_or_by_path(struct btrfs_root *root,
                                         char *device_path,
                                         struct btrfs_device **device);
-int btrfs_find_device_by_user_input(struct btrfs_root *root, u64 srcdevid,
-                                        char *srcdev_name,
+int btrfs_find_device_by_devspec(struct btrfs_root *root, u64 devid,
+                                        char *devpath,
                                         struct btrfs_device **device);
 struct btrfs_device *btrfs_alloc_device(struct btrfs_fs_info *fs_info,
                                        const u64 *devid,