]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
btrfs: create helper btrfs_find_device_by_user_input()
authorAnand Jain <anand.jain@oracle.com>
Sat, 13 Feb 2016 02:01:35 +0000 (10:01 +0800)
committerShan Hai <shan.hai@oracle.com>
Thu, 13 Jul 2017 05:20:22 +0000 (13:20 +0800)
The patch renames btrfs_dev_replace_find_srcdev() to
btrfs_find_device_by_user_input() and moves it to volumes.c, so that
delete device can use it.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Orabug: 26287586

(Cherry picked from commit 24e0474b59538cdb9d2b7318ec7c7ae9f6faf85d)

Signed-off-by: Shan Hai <shan.hai@oracle.com>
Reviewed-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
fs/btrfs/dev-replace.c
fs/btrfs/volumes.c
fs/btrfs/volumes.h

index 0573848c73337f2f7848dfdd2fd05e31d5f26a56..9fb82a038b54f4b825db5eca91c548b21a7c4f6c 100644 (file)
@@ -44,9 +44,6 @@ static void btrfs_dev_replace_update_device_in_mapping_tree(
                                                struct btrfs_fs_info *fs_info,
                                                struct btrfs_device *srcdev,
                                                struct btrfs_device *tgtdev);
-static int btrfs_dev_replace_find_srcdev(struct btrfs_root *root, u64 srcdevid,
-                                        char *srcdev_name,
-                                        struct btrfs_device **device);
 static u64 __btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info);
 static int btrfs_dev_replace_kthread(void *data);
 static int btrfs_dev_replace_continue_on_mount(struct btrfs_fs_info *fs_info);
@@ -343,7 +340,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_dev_replace_find_srcdev(root, args->start.srcdevid,
+       ret = btrfs_find_device_by_user_input(root, args->start.srcdevid,
                                            args->start.srcdev_name,
                                            &src_device);
        if (ret) {
@@ -623,25 +620,6 @@ static void btrfs_dev_replace_update_device_in_mapping_tree(
        write_unlock(&em_tree->lock);
 }
 
-static int btrfs_dev_replace_find_srcdev(struct btrfs_root *root, u64 srcdevid,
-                                        char *srcdev_name,
-                                        struct btrfs_device **device)
-{
-       int ret;
-
-       if (srcdevid) {
-               ret = 0;
-               *device = btrfs_find_device(root->fs_info, srcdevid, NULL,
-                                           NULL);
-               if (!*device)
-                       ret = -ENOENT;
-       } else {
-               ret = btrfs_find_device_missing_or_by_path(root, srcdev_name,
-                                                          device);
-       }
-       return ret;
-}
-
 void btrfs_dev_replace_status(struct btrfs_fs_info *fs_info,
                              struct btrfs_ioctl_dev_replace_args *args)
 {
index 399c629171244cd623b083f80f977edc0cceab97..4106a9cc9f3db49bb42905f7caf5fa358aec6363 100644 (file)
@@ -1963,6 +1963,25 @@ 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,
+                                        struct btrfs_device **device)
+{
+       int ret;
+
+       if (srcdevid) {
+               ret = 0;
+               *device = btrfs_find_device(root->fs_info, srcdevid, NULL,
+                                           NULL);
+               if (!*device)
+                       ret = -ENOENT;
+       } else {
+               ret = btrfs_find_device_missing_or_by_path(root, srcdev_name,
+                                                          device);
+       }
+       return ret;
+}
+
 /*
  * does all the dirty work required for changing file system's UUID.
  */
index b1a757accee60a32ecc73bcf154e7c835858ef8a..3096c1522be90f6cd41855fb0ef9ab0322269920 100644 (file)
@@ -431,6 +431,9 @@ 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,
+                                        struct btrfs_device **device);
 struct btrfs_device *btrfs_alloc_device(struct btrfs_fs_info *fs_info,
                                        const u64 *devid,
                                        const u8 *uuid);