From: Qu Wenruo <wqu@suse.com>
To: Wang Yugui <wangyugui@e16-tech.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs-progs: balance: fix some cases wrongly parsed as old syntax
Date: Wed, 14 Sep 2022 15:11:04 +0800 [thread overview]
Message-ID: <0f631df8-321d-023a-85fd-c80817affbbb@suse.com> (raw)
In-Reply-To: <20220914055846.52008-1-wangyugui@e16-tech.com>
On 2022/9/14 13:58, Wang Yugui wrote:
> Some cases of 'btrfs balance' are wrongly parsed as old syntax.
>
> an example:
> $ btrfs balance status
> ERROR: cannot access 'status': No such file or directory
>
> currently, only 'start' is successfully excluded in the check of old syntax.
> fix it by adding others in the check of old syntax.
>
> Signed-off-by: Wang Yugui <wangyugui@e16-tech.com>
The old code is over 10 years.
Can we just remove it completely?
Thanks,
Qu
> ---
> cmds/balance.c | 19 +++++++++++++++++--
> 1 file changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/cmds/balance.c b/cmds/balance.c
> index c5e10f92..bafd1714 100644
> --- a/cmds/balance.c
> +++ b/cmds/balance.c
> @@ -852,8 +852,23 @@ static const struct cmd_group balance_cmd_group = {
>
> static int cmd_balance(const struct cmd_struct *cmd, int argc, char **argv)
> {
> - if (argc == 2 && strcmp("start", argv[1]) != 0) {
> - /* old 'btrfs filesystem balance <path>' syntax */
> + bool old_syntax = true; /* old 'btrfs balance <path>' syntax */
> + if (argc >= 2)
> + {
> + int i;
> + for (i = 0; balance_cmd_group.commands[i] != NULL; i++)
> + {
> + if (strcmp(argv[1], balance_cmd_group.commands[i]->token) == 0)
> + {
> + old_syntax = false;
> + break;
> + }
> + }
> + } else {
> + old_syntax = false;
> + }
> + if (old_syntax)
> + {
> struct btrfs_ioctl_balance_args args;
>
> memset(&args, 0, sizeof(args));
next prev parent reply other threads:[~2022-09-14 7:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-14 5:58 [PATCH] btrfs-progs: balance: fix some cases wrongly parsed as old syntax Wang Yugui
2022-09-14 7:11 ` Qu Wenruo [this message]
2022-09-21 8:24 ` David Sterba
2022-09-21 15:34 ` [PATCH] btrfs-progs: balance: deprecate " Wang Yugui
2022-09-21 21:54 ` [PATCH v2] " Wang Yugui
2023-03-16 15:47 ` [PATCH] btrfs-progs: balance: fix some cases wrongly parsed as " 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=0f631df8-321d-023a-85fd-c80817affbbb@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=wangyugui@e16-tech.com \
/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