From: Anand Jain <anand.jain@oracle.com>
To: David Sterba <dsterba@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 14/15] btrfs: rename btrfs_find_device_by_user_input
Date: Tue, 16 Feb 2016 17:14:35 +0800 [thread overview]
Message-ID: <56C2E87B.9000506@oracle.com> (raw)
In-Reply-To: <fc1748ace148802b9a122ae6222aea742f7cb9ea.1455556900.git.dsterba@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Thanks, Anand
On 02/16/2016 01:34 AM, David Sterba wrote:
> 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.
>
> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
> fs/btrfs/dev-replace.c | 2 +-
> fs/btrfs/volumes.c | 17 ++++++++++-------
> fs/btrfs/volumes.h | 4 ++--
> 3 files changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
> index 3e2616d151d9..1731f92b6247 100644
> --- a/fs/btrfs/dev-replace.c
> +++ b/fs/btrfs/dev-replace.c
> @@ -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) {
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 8fee24f92574..05d9bc0cdd49 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -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;
> diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
> index a13a538cb01e..febdb7bc9370 100644
> --- a/fs/btrfs/volumes.h
> +++ b/fs/btrfs/volumes.h
> @@ -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,
>
next prev parent reply other threads:[~2016-02-16 9:14 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-15 17:33 [PATCH 00/15] Device delete by id David Sterba
2016-02-15 17:33 ` [PATCH 01/15] btrfs: create a helper function to read the disk super David Sterba
2016-02-15 17:34 ` [PATCH 02/15] btrfs: create helper function __check_raid_min_devices() David Sterba
2016-02-15 17:34 ` [PATCH 03/15] btrfs: clean up and optimize __check_raid_min_device() David Sterba
2016-02-15 17:34 ` [PATCH 04/15] btrfs: create helper btrfs_find_device_by_user_input() David Sterba
2016-02-15 17:34 ` [PATCH 05/15] btrfs: make use of btrfs_find_device_by_user_input() David Sterba
2016-02-15 17:34 ` [PATCH 06/15] btrfs: enhance btrfs_find_device_by_user_input() to check device path David Sterba
2016-02-15 17:34 ` [PATCH 07/15] btrfs: make use of btrfs_scratch_superblocks() in btrfs_rm_device() David Sterba
2016-02-15 17:34 ` [PATCH 08/15] btrfs: introduce device delete by devid David Sterba
2016-02-15 17:34 ` [PATCH 09/15] btrfs: optimize check for stale device David Sterba
2016-02-15 17:34 ` [PATCH 10/15] btrfs: rename __check_raid_min_devices David Sterba
2016-02-16 9:07 ` Anand Jain
2016-02-15 17:34 ` [PATCH 11/15] btrfs: pass number of devices to btrfs_check_raid_min_devices David Sterba
2016-02-16 9:08 ` Anand Jain
2016-02-15 17:34 ` [PATCH 12/15] btrfs: indtroduce raid-type to error-code table, for minimum device constraint David Sterba
2016-02-16 9:09 ` Anand Jain
2016-02-15 17:34 ` [PATCH 13/15] btrfs: use existing device constraints table btrfs_raid_array David Sterba
2016-02-16 9:13 ` Anand Jain
2016-02-15 17:34 ` [PATCH 14/15] btrfs: rename btrfs_find_device_by_user_input David Sterba
2016-02-16 9:14 ` Anand Jain [this message]
2016-02-15 17:34 ` [PATCH 15/15] btrfs: rename flags for vol args v2 David Sterba
2016-02-16 9:18 ` Anand Jain
2016-02-16 9:43 ` David Sterba
2016-02-25 17:59 ` [PATCH 00/15] Device delete by id David Sterba
2016-03-11 8:16 ` Anand Jain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56C2E87B.9000506@oracle.com \
--to=anand.jain@oracle.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).