Transpire global --verbose option down to the btrfs balance status
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 9c2cdacdb288..9f4ab21518de 100644
--- a/cmds/balance.c
+++ b/cmds/balance.c
@@ -828,6 +828,8 @@ static const char * const cmd_balance_status_usage[] = {
"Show status of running or paused balance",
"",
"-v|--verbose be verbose",
+ HELPINFO_INSERT_GLOBALS,
+ HELPINFO_INSERT_VERBOSE,
NULL
};
@@ -844,7 +846,6 @@ static int cmd_balance_status(const struct cmd_struct *cmd,
const char *path;
DIR *dirstream = NULL;
int fd;
- int verbose = 0;
int ret;
optind = 0;
@@ -861,7 +862,7 @@ static int cmd_balance_status(const struct cmd_struct *cmd,
switch (opt) {
case 'v':
- verbose = 1;
+ bconf_be_verbose();
break;
default:
usage_unknown_option(cmd, argv);
@@ -907,7 +908,7 @@ static int cmd_balance_status(const struct cmd_struct *cmd,
(unsigned long long)args.stat.considered,
100 * (1 - (float)args.stat.completed/args.stat.expected));
- if (verbose)
+ if (bconf.verbose > BTRFS_BCONF_QUIET)
dump_ioctl_balance_args(&args);
ret = 1;
--
1.8.3.1