From: Anand Jain <anand.jain@oracle.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/2] btrfs-progs: avoid duplicate checks on user provided devid
Date: Wed, 03 Jun 2015 15:49:49 +0800 [thread overview]
Message-ID: <556EB19D.6010807@oracle.com> (raw)
In-Reply-To: <20150602151234.GH6761@twin.jikos.cz>
On 06/02/2015 11:12 PM, David Sterba wrote:
> On Mon, Jun 01, 2015 at 02:25:17PM +0800, Anand Jain wrote:
>> kernel is already checking it (rightly), we don't need to check that in the user land.
>
> Sometimes it's useful to duplicate the checks in userspace because we
> can fail early and return the error message directly, compared to
> messages in syslog or a simple errno.
right. But here what do you feel about the gain obtained vs additional
code thats required ?
My take: get_fs_info() calls check_mounted_where() which in turn calls
btrfs_scan_lblkid(), which is system wide scan of all block devices,
thats heavy weight.
My past tests showed visible delay/jitter in the output of
'btrfs fi show -d' when btrfs scrub is running. The main culprit
is check_mounted_where calling btrfs_scan_lblkid. so its recommend
to run get_fs_info() only if required.
> Have you observed that the userspace checks were problematic?
Nope. Just a cleanup. With this patch cmd_start_replace() would
should match with cmd_rm_dev().
As both 'btrfs dev del <devid> ..' and 'btrfs replace start <devid> .."
intentions are same, so theoretically up to certain extent their codes
should match.
>> @@ -214,33 +213,7 @@ static int cmd_start_replace(int argc, char **argv)
>> }
>>
>> if (is_numerical(srcdev)) {
>> - struct btrfs_ioctl_fs_info_args fi_args;
>> - struct btrfs_ioctl_dev_info_args *di_args = NULL;
>> -
>> start_args.start.srcdevid = arg_strtou64(srcdev);
>> -
>> - ret = get_fs_info(path, &fi_args, &di_args);
>
> This does additional checks, like checking where it's mounted.
in this part of the if statement srcdev is <num> and is devid.
get_fs_info check does not help.
What did I miss ?
Thanks Anand
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2015-06-03 7:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-01 6:25 [PATCH 1/2] btrfs-progs: avoid duplicate checks on user provided devid Anand Jain
2015-06-01 6:25 ` [PATCH 2/2] btrfs-progs: use function is_block_device() instead Anand Jain
2015-06-02 15:17 ` David Sterba
2015-06-02 15:12 ` [PATCH 1/2] btrfs-progs: avoid duplicate checks on user provided devid David Sterba
2015-06-03 7:49 ` Anand Jain [this message]
2015-06-04 3:09 ` Anand Jain
2015-06-05 15:36 ` David Sterba
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=556EB19D.6010807@oracle.com \
--to=anand.jain@oracle.com \
--cc=dsterba@suse.cz \
--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