btrfs-progs: balance: print warn mesg in old command
PATCH v2 1/1 btrfs-progs: balance: print warn mesg in old command
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
---
v2:
- Prints warning message in do_balance()
--- cmds/balance.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
cmds/balance.c +18 -18
@@ -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 )
Signature · 1 line
2.25.1
Quoted 8 lines · 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 usesdo_balance().Issue: #411
Signed-off-by Sidong Yang <[email protected]>
Thanks,
Qu
Quoted 61 lines
---
v2:
- Prints warning message indo_balance()--- cmds/balance.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)cmds/balance.c +17
-18@@ -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 )
Quoted 11 lines · 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 usesdo_balance().Issue: #411
Signed-off-by Sidong Yang <[email protected]>---
v2:
- Prints warning message indo_balance()
Added to devel and queued for 5.15, thanks.
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 ([email protected])
2021/11/05
Quoted 71 lines
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 usesdo_balance().Issue: #411
Signed-off-by Sidong Yang <[email protected]>---
v2:
- Prints warning message indo_balance()--- cmds/balance.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)cmds/balance.c +18
-18@@ -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 )Signature · 1 line
2.25.1
Quoted 8 lines · Wang Yugui
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.
Quoted 9 lines · David Sterba
Quoted 8 lines · Wang Yugui
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.
Quoted 3 lines
Right, I ran all the other tests than test-cli. I'll remove the patch from 5.15 queue.