btrfs-progs: balance status: add global verbose option

Propagate global --verbose option down to the btrfs balance status
subcommand.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Anand Jain 2019-11-25 18:39:09 +08:00 committed by David Sterba
parent 2540a6d12d
commit 25c8817d87

View File

@ -830,6 +830,8 @@ static const char * const cmd_balance_status_usage[] = {
"Show status of running or paused balance", "Show status of running or paused balance",
"", "",
"-v|--verbose be verbose", "-v|--verbose be verbose",
HELPINFO_INSERT_GLOBALS,
HELPINFO_INSERT_VERBOSE,
NULL NULL
}; };
@ -846,7 +848,6 @@ static int cmd_balance_status(const struct cmd_struct *cmd,
const char *path; const char *path;
DIR *dirstream = NULL; DIR *dirstream = NULL;
int fd; int fd;
int verbose = 0;
int ret; int ret;
optind = 0; optind = 0;
@ -863,7 +864,7 @@ static int cmd_balance_status(const struct cmd_struct *cmd,
switch (opt) { switch (opt) {
case 'v': case 'v':
verbose = 1; bconf_be_verbose();
break; break;
default: default:
usage_unknown_option(cmd, argv); usage_unknown_option(cmd, argv);
@ -909,7 +910,7 @@ static int cmd_balance_status(const struct cmd_struct *cmd,
(unsigned long long)args.stat.considered, (unsigned long long)args.stat.considered,
100 * (1 - (float)args.stat.completed/args.stat.expected)); 100 * (1 - (float)args.stat.completed/args.stat.expected));
if (verbose) if (bconf.verbose > BTRFS_BCONF_QUIET)
dump_ioctl_balance_args(&args); dump_ioctl_balance_args(&args);
ret = 1; ret = 1;