Command btrfs inspect-internal logical-resolve provides local verbose option this patch makes it enable-able by using the global --verbose option.
Suggested-by: David Sterba <dste...@suse.com> Signed-off-by: Anand Jain <anand.j...@oracle.com> --- cmds/inspect.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/cmds/inspect.c b/cmds/inspect.c index f872b471b420..3f35cdea56b5 100644 --- a/cmds/inspect.c +++ b/cmds/inspect.c @@ -40,7 +40,7 @@ static const char * const inspect_cmd_group_usage[] = { NULL }; -static int __ino_to_path_fd(u64 inum, int fd, int verbose, const char *prepend) +static int __ino_to_path_fd(u64 inum, int fd, const char *prepend) { int ret; int i; @@ -118,8 +118,7 @@ static int cmd_inspect_inode_resolve(const struct cmd_struct *cmd, if (fd < 0) return 1; - ret = __ino_to_path_fd(arg_strtou64(argv[optind]), fd, - global_verbose ? 1 : 0, argv[optind+1]); + ret = __ino_to_path_fd(arg_strtou64(argv[optind]), fd, argv[optind+1]); close_file_or_dir(fd, dirstream); return !!ret; @@ -130,11 +129,11 @@ static const char * const cmd_inspect_logical_resolve_usage[] = { "btrfs inspect-internal logical-resolve [-Pv] [-s bufsize] <logical> <path>", "Get file system paths for the given logical address", "", - "-P skip the path resolving and print the inodes instead", - "-v verbose mode", - "-s bufsize set inode container's size. This is used to increase inode", - " container's size in case it is not enough to read all the ", - " resolved results. The max value one can set is 64k", + "-P skip the path resolving and print the inodes instead", + HELPINFO_INSERT_VERBOSE_SHORT, + "-s bufsize set inode container's size. This is used to increase inode", + " container's size in case it is not enough to read all the ", + " resolved results. The max value one can set is 64k", NULL }; @@ -144,7 +143,6 @@ static int cmd_inspect_logical_resolve(const struct cmd_struct *cmd, int ret; int fd; int i; - int verbose = 0; int getpath = 1; int bytes_left; struct btrfs_ioctl_logical_ino_args loi; @@ -165,7 +163,7 @@ static int cmd_inspect_logical_resolve(const struct cmd_struct *cmd, getpath = 0; break; case 'v': - verbose = 1; + global_verbose = true; break; case 's': size = arg_strtou64(optarg); @@ -200,8 +198,8 @@ static int cmd_inspect_logical_resolve(const struct cmd_struct *cmd, goto out; } - if (verbose) - printf("ioctl ret=%d, total_size=%llu, bytes_left=%lu, " + pr_verbose(global_verbose, + "ioctl ret=%d, total_size=%llu, bytes_left=%lu, " "bytes_missing=%lu, cnt=%d, missed=%d\n", ret, size, (unsigned long)inodes->bytes_left, @@ -251,8 +249,7 @@ static int cmd_inspect_logical_resolve(const struct cmd_struct *cmd, goto out; } } - ret = __ino_to_path_fd(inum, path_fd, verbose, - full_path); + ret = __ino_to_path_fd(inum, path_fd, full_path); if (path_fd != fd) close_file_or_dir(path_fd, dirs); } else { -- 1.8.3.1