2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-02 18:54:10 +08:00

btrfs: rename btrfs_find_device_by_user_input

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>
This commit is contained in:
David Sterba 2016-02-15 16:39:55 +01:00
parent 418775a22b
commit 5c5c0df05d
3 changed files with 13 additions and 10 deletions

View File

@ -322,7 +322,7 @@ int btrfs_dev_replace_start(struct btrfs_root *root,
/* the disk copy procedure reuses the scrub code */ /* the disk copy procedure reuses the scrub code */
mutex_lock(&fs_info->volume_mutex); 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, args->start.srcdev_name,
&src_device); &src_device);
if (ret) { if (ret) {

View File

@ -1780,7 +1780,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path, u64 devid)
if (ret) if (ret)
goto out; goto out;
ret = btrfs_find_device_by_user_input(root, devid, device_path, ret = btrfs_find_device_by_devspec(root, devid, device_path,
&device); &device);
if (ret) if (ret)
goto out; 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) struct btrfs_device **device)
{ {
int ret; int ret;
if (srcdevid) { if (devid) {
ret = 0; ret = 0;
*device = btrfs_find_device(root->fs_info, srcdevid, NULL, *device = btrfs_find_device(root->fs_info, devid, NULL,
NULL); NULL);
if (!*device) if (!*device)
ret = -ENOENT; ret = -ENOENT;
} else { } else {
if (!srcdev_name || !srcdev_name[0]) if (!devpath || !devpath[0])
return -EINVAL; return -EINVAL;
ret = btrfs_find_device_missing_or_by_path(root, srcdev_name, ret = btrfs_find_device_missing_or_by_path(root, devpath,
device); device);
} }
return ret; return ret;

View 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, int btrfs_find_device_missing_or_by_path(struct btrfs_root *root,
char *device_path, char *device_path,
struct btrfs_device **device); struct btrfs_device **device);
int btrfs_find_device_by_user_input(struct btrfs_root *root, u64 srcdevid, int btrfs_find_device_by_devspec(struct btrfs_root *root, u64 devid,
char *srcdev_name, char *devpath,
struct btrfs_device **device); struct btrfs_device **device);
struct btrfs_device *btrfs_alloc_device(struct btrfs_fs_info *fs_info, struct btrfs_device *btrfs_alloc_device(struct btrfs_fs_info *fs_info,
const u64 *devid, const u64 *devid,