Transpire global --verbose option down to the btrfs balance start
sub-command.
Suggested-by: David Sterba <dsterba@xxxxxxxx>
Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx>
---
v2: Use new helper functions and defines
HELPINFO_INSERT_GLOBALS, BTRFS_BCONF_UNSET, BTRFS_BCONF_QUIET
bconf_be_verbose(), bconf_be_quiet()
No need to init bconf.verbose in the sub command.
cmds/balance.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/cmds/balance.c b/cmds/balance.c
index 5392a6040a02..9c2cdacdb288 100644
--- a/cmds/balance.c
+++ b/cmds/balance.c
@@ -499,6 +499,8 @@ static const char * const cmd_balance_start_usage[] = {
"--full-balance do not print warning and do not delay start",
"--background|--bg",
" run the balance as a background process",
+ HELPINFO_INSERT_GLOBALS,
+ HELPINFO_INSERT_VERBOSE,
NULL
};
@@ -509,7 +511,6 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
struct btrfs_balance_args *ptrs[] = { &args.data, &args.sys,
&args.meta, NULL };
int force = 0;
- int verbose = 0;
int background = 0;
unsigned start_flags = 0;
int i;
@@ -564,7 +565,7 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
force = 1;
break;
case 'v':
- verbose = 1;
+ bconf_be_verbose();
break;
case GETOPT_VAL_FULL_BALANCE:
start_flags |= BALANCE_START_NOWARN;
@@ -640,7 +641,7 @@ static int cmd_balance_start(const struct cmd_struct *cmd,
if (force)
args.flags |= BTRFS_BALANCE_FORCE;
- if (verbose)
+ if (bconf.verbose > BTRFS_BCONF_QUIET)
dump_ioctl_balance_args(&args);
if (background) {
switch (fork()) {
--
1.8.3.1