Skip to content

Commit 5c5c0df

Browse files
committed
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>
1 parent 418775a commit 5c5c0df

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

‎fs/btrfs/dev-replace.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ int btrfs_dev_replace_start(struct btrfs_root *root,
322322

323323
/* the disk copy procedure reuses the scrub code */
324324
mutex_lock(&fs_info->volume_mutex);
325-
ret = btrfs_find_device_by_user_input(root, args->start.srcdevid,
325+
ret = btrfs_find_device_by_devspec(root, args->start.srcdevid,
326326
args->start.srcdev_name,
327327
&src_device);
328328
if (ret) {

‎fs/btrfs/volumes.c‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,7 +1780,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path, u64 devid)
17801780
if (ret)
17811781
goto out;
17821782

1783-
ret = btrfs_find_device_by_user_input(root, devid, device_path,
1783+
ret = btrfs_find_device_by_devspec(root, devid, device_path,
17841784
&device);
17851785
if (ret)
17861786
goto out;
@@ -2065,23 +2065,26 @@ int btrfs_find_device_missing_or_by_path(struct btrfs_root *root,
20652065
}
20662066
}
20672067

2068-
int btrfs_find_device_by_user_input(struct btrfs_root *root, u64 srcdevid,
2069-
char *srcdev_name,
2068+
/*
2069+
* Lookup a device given by device id, or the path if the id is 0.
2070+
*/
2071+
int btrfs_find_device_by_devspec(struct btrfs_root *root, u64 devid,
2072+
char *devpath,
20702073
struct btrfs_device **device)
20712074
{
20722075
int ret;
20732076

2074-
if (srcdevid) {
2077+
if (devid) {
20752078
ret = 0;
2076-
*device = btrfs_find_device(root->fs_info, srcdevid, NULL,
2079+
*device = btrfs_find_device(root->fs_info, devid, NULL,
20772080
NULL);
20782081
if (!*device)
20792082
ret = -ENOENT;
20802083
} else {
2081-
if (!srcdev_name || !srcdev_name[0])
2084+
if (!devpath || !devpath[0])
20822085
return -EINVAL;
20832086

2084-
ret = btrfs_find_device_missing_or_by_path(root, srcdev_name,
2087+
ret = btrfs_find_device_missing_or_by_path(root, devpath,
20852088
device);
20862089
}
20872090
return ret;

‎fs/btrfs/volumes.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,8 @@ void btrfs_close_extra_devices(struct btrfs_fs_devices *fs_devices, int step);
448448
int btrfs_find_device_missing_or_by_path(struct btrfs_root *root,
449449
char *device_path,
450450
struct btrfs_device **device);
451-
int btrfs_find_device_by_user_input(struct btrfs_root *root, u64 srcdevid,
452-
char *srcdev_name,
451+
int btrfs_find_device_by_devspec(struct btrfs_root *root, u64 devid,
452+
char *devpath,
453453
struct btrfs_device **device);
454454
struct btrfs_device *btrfs_alloc_device(struct btrfs_fs_info *fs_info,
455455
const u64 *devid,

0 commit comments

Comments
 (0)