@@ -87,7 +87,8 @@ wait for transaction commit at the end of the operation.
wait for transaction commit after deleting each subvolume.
+
-v|--verbose::::
-verbose output of operations.
+verbose output of operations. This option is merged to the global verbose
+option.
+
-i|--subvolid <subvolid>::::
subvolume id to be removed instead of the <path> that should point to the
@@ -236,7 +236,10 @@ static const char * const cmd_subvol_delete_usage[] = {
"-c|--commit-after wait for transaction commit at the end of the operation",
"-C|--commit-each wait for transaction commit after deleting each subvolume",
"-i|--subvolid subvolume id of the to be removed subvolume",
- "-v|--verbose verbose output of operations",
+ "-v|--verbose verbose output of operations. This option is",
+ " merged to the global verbose option.",
+ HELPINFO_INSERT_GLOBALS,
+ HELPINFO_INSERT_VERBOSE,
NULL
};
@@ -251,7 +254,6 @@ static int cmd_subvol_delete(const struct cmd_struct *cmd,
char *dupvname = NULL;
char *path = NULL;
DIR *dirstream = NULL;
- int verbose = 0;
int commit_mode = 0;
u8 fsid[BTRFS_FSID_SIZE];
u64 subvolid = 0;
@@ -287,7 +289,7 @@ static int cmd_subvol_delete(const struct cmd_struct *cmd,
subvolid = arg_strtou64(optarg);
break;
case 'v':
- verbose++;
+ bconf_be_verbose();
break;
default:
usage_unknown_option(cmd, argv);
@@ -301,11 +303,9 @@ static int cmd_subvol_delete(const struct cmd_struct *cmd,
if (subvolid > 0 && check_argc_exact(argc - optind, 1))
return 1;
- if (verbose > 0) {
- printf("Transaction commit: %s\n",
- !commit_mode ? "none (default)" :
- commit_mode == COMMIT_AFTER ? "at the end" : "after each");
- }
+ pr_verbose(1, "Transaction commit: %s\n",
+ !commit_mode ? "none (default)" :
+ commit_mode == COMMIT_AFTER ? "at the end" : "after each");
cnt = optind;
@@ -395,11 +395,9 @@ again:
}
if (add_seen_fsid(fsid, seen_fsid_hash, fd, dirstream) == 0) {
- if (verbose > 0) {
- uuid_unparse(fsid, uuidbuf);
- printf(" new fs is found for '%s', fsid: %s\n",
- path, uuidbuf);
- }
+ uuid_unparse(fsid, uuidbuf);
+ pr_verbose(1, " new fs is found for '%s', fsid: %s\n",
+ path, uuidbuf);
/*
* This is the first time a subvolume on this
* filesystem is deleted, keep fd in order to issue
@@ -440,10 +438,11 @@ keep_fd:
"unable to do final sync after deletion: %m, fsid: %s",
uuidbuf);
ret = 1;
- } else if (verbose > 0) {
+ } else {
uuid_unparse(seen->fsid, uuidbuf);
- printf("final sync is done for fsid: %s\n",
- uuidbuf);
+ pr_verbose(1,
+ "final sync is done for fsid: %s\n",
+ uuidbuf);
}
seen = seen->next;
}
Transpire global --verbose option down to the btrfs subvolume delete sub-command. Suggested-by: David Sterba <dsterba@suse.com> Signed-off-by: Anand Jain <anand.jain@oracle.com> --- V3: Update the help and documentation v2: Use new helper functions and defines HELPINFO_INSERT_GLOBALS, BTRFS_BCONF_UNSET, BTRFS_BCONF_QUIET bconf_be_verbose(), bconf_be_quiet() Documentation/btrfs-subvolume.asciidoc | 3 ++- cmds/subvolume.c | 31 +++++++++++++------------- 2 files changed, 17 insertions(+), 17 deletions(-)