[RFC,04/14] btrfs-progs: migrate btrfs balance start to global verbose
diff mbox series

Message ID 1571652082-25982-5-git-send-email-anand.jain@oracle.com
State New
Headers show
Series
  • btrfs-progs: global-verbose option
Related show

Commit Message

Anand Jain Oct. 21, 2019, 10:01 a.m. UTC
Make sure the sub command balance start calls verbose when the global
verbose is set and vise versa.

Suggested-by: David Sterba <dsterba@suse.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 cmds/balance.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

Patch
diff mbox series

diff --git a/cmds/balance.c b/cmds/balance.c
index 32830002f3a0..7e84efd6a80d 100644
--- a/cmds/balance.c
+++ b/cmds/balance.c
@@ -34,6 +34,8 @@ 
 #include "common/utils.h"
 #include "common/help.h"
 
+extern bool global_verbose;
+
 static const char * const balance_cmd_group_usage[] = {
 	"btrfs balance <command> [options] <path>",
 	"btrfs balance <path>",
@@ -487,14 +489,13 @@  static const char * const cmd_balance_start_usage[] = {
 	"long operation and the user is warned before this start, with",
 	"a delay to stop it.",
 	"",
-	"-d[filters]    act on data chunks",
-	"-m[filters]    act on metadata chunks",
-	"-s[filters]    act on system chunks (only under -f)",
-	"-v             be verbose",
-	"-f             force a reduction of metadata integrity",
-	"--full-balance do not print warning and do not delay start",
-	"--background|--bg",
-	"               run the balance as a background process",
+	"-d[filters]        act on data chunks",
+	"-m[filters]        act on metadata chunks",
+	"-s[filters]        act on system chunks (only under -f)",
+	HELPINFO_INSERT_VERBOSE_SHORT,
+	"-f                 force a reduction of metadata integrity",
+	"--full-balance     do not print warning and do not delay start",
+	"--background|--bg  run the balance as a background process",
 	NULL
 };
 
@@ -505,7 +506,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;
@@ -560,7 +560,7 @@  static int cmd_balance_start(const struct cmd_struct *cmd,
 			force = 1;
 			break;
 		case 'v':
-			verbose = 1;
+			global_verbose = true;
 			break;
 		case GETOPT_VAL_FULL_BALANCE:
 			start_flags |= BALANCE_START_NOWARN;
@@ -636,7 +636,7 @@  static int cmd_balance_start(const struct cmd_struct *cmd,
 
 	if (force)
 		args.flags |= BTRFS_BALANCE_FORCE;
-	if (verbose)
+	if (global_verbose)
 		dump_ioctl_balance_args(&args);
 	if (background) {
 		switch (fork()) {