diff options
author | Anand Jain <anand.jain@oracle.com> | 2016-02-13 03:01:35 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-04-28 10:59:13 +0200 |
commit | 24e0474b59538cdb9d2b7318ec7c7ae9f6faf85d (patch) | |
tree | 6003a14ab7655ca8b965486dd500ec50c2194606 /fs/btrfs/volumes.c | |
parent | btrfs: clean up and optimize __check_raid_min_device() (diff) | |
download | linux-24e0474b59538cdb9d2b7318ec7c7ae9f6faf85d.tar.xz linux-24e0474b59538cdb9d2b7318ec7c7ae9f6faf85d.zip |
btrfs: create helper btrfs_find_device_by_user_input()
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>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 5538dc78c72e..ab28d9dc1b0d 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -2126,6 +2126,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. */ |