* [PATCH v2] btrfs-progs: balance: print warn mesg in old command
@ 2021-10-31 13:10 Sidong Yang
2021-11-01 11:35 ` Qu Wenruo
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Sidong Yang @ 2021-10-31 13:10 UTC (permalink / raw)
To: linux-btrfs; +Cc: Sidong Yang
This patch makes old balance command to print warning message same as
in start command. It makes do_balance() checks flags that needs to
print warning message. It works in old command because old command also
uses do_balance().
Issue: #411
Signed-off-by: Sidong Yang <realwakka@gmail.com>
---
v2:
- Prints warning message in do_balance()
---
cmds/balance.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/cmds/balance.c b/cmds/balance.c
index 7abc69d9..2e903b5c 100644
--- a/cmds/balance.c
+++ b/cmds/balance.c
@@ -322,6 +322,24 @@ static int do_balance(const char *path, struct btrfs_ioctl_balance_args *args,
return 1;
}
+ if (!(flags & BALANCE_START_FILTERS) && !(flags & BALANCE_START_NOWARN)) {
+ int delay = 10;
+
+ printf("WARNING:\n\n");
+ printf("\tFull balance without filters requested. This operation is very\n");
+ printf("\tintense and takes potentially very long. It is recommended to\n");
+ printf("\tuse the balance filters to narrow down the scope of balance.\n");
+ printf("\tUse 'btrfs balance start --full-balance' option to skip this\n");
+ printf("\twarning. The operation will start in %d seconds.\n", delay);
+ printf("\tUse Ctrl-C to stop it.\n");
+ while (delay) {
+ printf("%2d", delay--);
+ fflush(stdout);
+ sleep(1);
+ }
+ printf("\nStarting balance without any filters.\n");
+ }
+
ret = ioctl(fd, BTRFS_IOC_BALANCE_V2, args);
if (ret < 0) {
/*
@@ -547,24 +565,6 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
printf("\nStarting conversion to RAID5/6.\n");
}
- if (!(start_flags & BALANCE_START_FILTERS) && !(start_flags & BALANCE_START_NOWARN)) {
- int delay = 10;
-
- printf("WARNING:\n\n");
- printf("\tFull balance without filters requested. This operation is very\n");
- printf("\tintense and takes potentially very long. It is recommended to\n");
- printf("\tuse the balance filters to narrow down the scope of balance.\n");
- printf("\tUse 'btrfs balance start --full-balance' option to skip this\n");
- printf("\twarning. The operation will start in %d seconds.\n", delay);
- printf("\tUse Ctrl-C to stop it.\n");
- while (delay) {
- printf("%2d", delay--);
- fflush(stdout);
- sleep(1);
- }
- printf("\nStarting balance without any filters.\n");
- }
-
if (force)
args.flags |= BTRFS_BALANCE_FORCE;
if (bconf.verbose > BTRFS_BCONF_QUIET)
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] btrfs-progs: balance: print warn mesg in old command
2021-10-31 13:10 [PATCH v2] btrfs-progs: balance: print warn mesg in old command Sidong Yang
@ 2021-11-01 11:35 ` Qu Wenruo
2021-11-02 17:02 ` David Sterba
2021-11-05 8:05 ` Wang Yugui
2 siblings, 0 replies; 6+ messages in thread
From: Qu Wenruo @ 2021-11-01 11:35 UTC (permalink / raw)
To: Sidong Yang, linux-btrfs
On 2021/10/31 21:10, Sidong Yang wrote:
> This patch makes old balance command to print warning message same as
> in start command. It makes do_balance() checks flags that needs to
> print warning message. It works in old command because old command also
> uses do_balance().
>
> Issue: #411
>
> Signed-off-by: Sidong Yang <realwakka@gmail.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Thanks,
Qu
> ---
> v2:
> - Prints warning message in do_balance()
> ---
> cmds/balance.c | 36 ++++++++++++++++++------------------
> 1 file changed, 18 insertions(+), 18 deletions(-)
>
> diff --git a/cmds/balance.c b/cmds/balance.c
> index 7abc69d9..2e903b5c 100644
> --- a/cmds/balance.c
> +++ b/cmds/balance.c
> @@ -322,6 +322,24 @@ static int do_balance(const char *path, struct btrfs_ioctl_balance_args *args,
> return 1;
> }
>
> + if (!(flags & BALANCE_START_FILTERS) && !(flags & BALANCE_START_NOWARN)) { > + int delay = 10;
> +
> + printf("WARNING:\n\n");
> + printf("\tFull balance without filters requested. This operation is very\n");
> + printf("\tintense and takes potentially very long. It is recommended to\n");
> + printf("\tuse the balance filters to narrow down the scope of balance.\n");
> + printf("\tUse 'btrfs balance start --full-balance' option to skip this\n");
> + printf("\twarning. The operation will start in %d seconds.\n", delay);
> + printf("\tUse Ctrl-C to stop it.\n");
> + while (delay) {
> + printf("%2d", delay--);
> + fflush(stdout);
> + sleep(1);
> + }
> + printf("\nStarting balance without any filters.\n");
> + }
> +
> ret = ioctl(fd, BTRFS_IOC_BALANCE_V2, args);
> if (ret < 0) {
> /*
> @@ -547,24 +565,6 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
> printf("\nStarting conversion to RAID5/6.\n");
> }
>
> - if (!(start_flags & BALANCE_START_FILTERS) && !(start_flags & BALANCE_START_NOWARN)) {
> - int delay = 10;
> -
> - printf("WARNING:\n\n");
> - printf("\tFull balance without filters requested. This operation is very\n");
> - printf("\tintense and takes potentially very long. It is recommended to\n");
> - printf("\tuse the balance filters to narrow down the scope of balance.\n");
> - printf("\tUse 'btrfs balance start --full-balance' option to skip this\n");
> - printf("\twarning. The operation will start in %d seconds.\n", delay);
> - printf("\tUse Ctrl-C to stop it.\n");
> - while (delay) {
> - printf("%2d", delay--);
> - fflush(stdout);
> - sleep(1);
> - }
> - printf("\nStarting balance without any filters.\n");
> - }
> -
> if (force)
> args.flags |= BTRFS_BALANCE_FORCE;
> if (bconf.verbose > BTRFS_BCONF_QUIET)
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] btrfs-progs: balance: print warn mesg in old command
2021-10-31 13:10 [PATCH v2] btrfs-progs: balance: print warn mesg in old command Sidong Yang
2021-11-01 11:35 ` Qu Wenruo
@ 2021-11-02 17:02 ` David Sterba
2021-11-05 8:05 ` Wang Yugui
2 siblings, 0 replies; 6+ messages in thread
From: David Sterba @ 2021-11-02 17:02 UTC (permalink / raw)
To: Sidong Yang; +Cc: linux-btrfs
On Sun, Oct 31, 2021 at 01:10:11PM +0000, Sidong Yang wrote:
> This patch makes old balance command to print warning message same as
> in start command. It makes do_balance() checks flags that needs to
> print warning message. It works in old command because old command also
> uses do_balance().
>
> Issue: #411
>
> Signed-off-by: Sidong Yang <realwakka@gmail.com>
> ---
> v2:
> - Prints warning message in do_balance()
Added to devel and queued for 5.15, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] btrfs-progs: balance: print warn mesg in old command
2021-10-31 13:10 [PATCH v2] btrfs-progs: balance: print warn mesg in old command Sidong Yang
2021-11-01 11:35 ` Qu Wenruo
2021-11-02 17:02 ` David Sterba
@ 2021-11-05 8:05 ` Wang Yugui
2021-11-05 11:50 ` David Sterba
2 siblings, 1 reply; 6+ messages in thread
From: Wang Yugui @ 2021-11-05 8:05 UTC (permalink / raw)
To: Sidong Yang; +Cc: linux-btrfs
Hi,
This patch broken tests/cli-tests/002-balance-full-no-filters.
becasue this
printf("WARNING:\n\n");
printf("\tFull balance without filters requested. This operation is very\n");
is put after fork() in this patch when '--backgroud';
Best Regards
Wang Yugui (wangyugui@e16-tech.com)
2021/11/05
> This patch makes old balance command to print warning message same as
> in start command. It makes do_balance() checks flags that needs to
> print warning message. It works in old command because old command also
> uses do_balance().
>
> Issue: #411
>
> Signed-off-by: Sidong Yang <realwakka@gmail.com>
> ---
> v2:
> - Prints warning message in do_balance()
> ---
> cmds/balance.c | 36 ++++++++++++++++++------------------
> 1 file changed, 18 insertions(+), 18 deletions(-)
>
> diff --git a/cmds/balance.c b/cmds/balance.c
> index 7abc69d9..2e903b5c 100644
> --- a/cmds/balance.c
> +++ b/cmds/balance.c
> @@ -322,6 +322,24 @@ static int do_balance(const char *path, struct btrfs_ioctl_balance_args *args,
> return 1;
> }
>
> + if (!(flags & BALANCE_START_FILTERS) && !(flags & BALANCE_START_NOWARN)) {
> + int delay = 10;
> +
> + printf("WARNING:\n\n");
> + printf("\tFull balance without filters requested. This operation is very\n");
> + printf("\tintense and takes potentially very long. It is recommended to\n");
> + printf("\tuse the balance filters to narrow down the scope of balance.\n");
> + printf("\tUse 'btrfs balance start --full-balance' option to skip this\n");
> + printf("\twarning. The operation will start in %d seconds.\n", delay);
> + printf("\tUse Ctrl-C to stop it.\n");
> + while (delay) {
> + printf("%2d", delay--);
> + fflush(stdout);
> + sleep(1);
> + }
> + printf("\nStarting balance without any filters.\n");
> + }
> +
> ret = ioctl(fd, BTRFS_IOC_BALANCE_V2, args);
> if (ret < 0) {
> /*
> @@ -547,24 +565,6 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
> printf("\nStarting conversion to RAID5/6.\n");
> }
>
> - if (!(start_flags & BALANCE_START_FILTERS) && !(start_flags & BALANCE_START_NOWARN)) {
> - int delay = 10;
> -
> - printf("WARNING:\n\n");
> - printf("\tFull balance without filters requested. This operation is very\n");
> - printf("\tintense and takes potentially very long. It is recommended to\n");
> - printf("\tuse the balance filters to narrow down the scope of balance.\n");
> - printf("\tUse 'btrfs balance start --full-balance' option to skip this\n");
> - printf("\twarning. The operation will start in %d seconds.\n", delay);
> - printf("\tUse Ctrl-C to stop it.\n");
> - while (delay) {
> - printf("%2d", delay--);
> - fflush(stdout);
> - sleep(1);
> - }
> - printf("\nStarting balance without any filters.\n");
> - }
> -
> if (force)
> args.flags |= BTRFS_BALANCE_FORCE;
> if (bconf.verbose > BTRFS_BCONF_QUIET)
> --
> 2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] btrfs-progs: balance: print warn mesg in old command
2021-11-05 8:05 ` Wang Yugui
@ 2021-11-05 11:50 ` David Sterba
2021-11-06 6:03 ` Sidong Yang
0 siblings, 1 reply; 6+ messages in thread
From: David Sterba @ 2021-11-05 11:50 UTC (permalink / raw)
To: Wang Yugui; +Cc: Sidong Yang, linux-btrfs
On Fri, Nov 05, 2021 at 04:05:41PM +0800, Wang Yugui wrote:
> Hi,
>
> This patch broken tests/cli-tests/002-balance-full-no-filters.
>
> becasue this
> printf("WARNING:\n\n");
> printf("\tFull balance without filters requested. This operation is very\n");
> is put after fork() in this patch when '--backgroud';
Right, I ran all the other tests than test-cli. I'll remove the patch
from 5.15 queue.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] btrfs-progs: balance: print warn mesg in old command
2021-11-05 11:50 ` David Sterba
@ 2021-11-06 6:03 ` Sidong Yang
0 siblings, 0 replies; 6+ messages in thread
From: Sidong Yang @ 2021-11-06 6:03 UTC (permalink / raw)
To: dsterba, Wang Yugui, linux-btrfs
On Fri, Nov 05, 2021 at 12:50:36PM +0100, David Sterba wrote:
> On Fri, Nov 05, 2021 at 04:05:41PM +0800, Wang Yugui wrote:
> > Hi,
> >
> > This patch broken tests/cli-tests/002-balance-full-no-filters.
> >
> > becasue this
> > printf("WARNING:\n\n");
> > printf("\tFull balance without filters requested. This operation is very\n");
> > is put after fork() in this patch when '--backgroud';
Thanks, This patch has an issue. I should work on it.
>
> Right, I ran all the other tests than test-cli. I'll remove the patch
> from 5.15 queue.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-11-06 6:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-31 13:10 [PATCH v2] btrfs-progs: balance: print warn mesg in old command Sidong Yang
2021-11-01 11:35 ` Qu Wenruo
2021-11-02 17:02 ` David Sterba
2021-11-05 8:05 ` Wang Yugui
2021-11-05 11:50 ` David Sterba
2021-11-06 6:03 ` Sidong Yang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.