diff --git a/cmds/inspect.c b/cmds/inspect.c index aca7fb96..8593b3fd 100644 --- a/cmds/inspect.c +++ b/cmds/inspect.c @@ -38,7 +38,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; @@ -117,8 +117,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, - bconf.verbose, argv[optind+1]); + ret = __ino_to_path_fd(arg_strtou64(argv[optind]), fd, argv[optind+1]); close_file_or_dir(fd, dirstream); return !!ret; @@ -137,6 +136,8 @@ static const char * const cmd_inspect_logical_resolve_usage[] = { " container's size in case it is not enough to read all the ", " resolved results. The max value one can set is 64k with the", " v1 ioctl. Sizes over 64k will use the v2 ioctl (kernel 4.15+)", + HELPINFO_INSERT_GLOBALS, + HELPINFO_INSERT_VERBOSE, NULL }; @@ -146,7 +147,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 = { 0 }; @@ -169,7 +169,7 @@ static int cmd_inspect_logical_resolve(const struct cmd_struct *cmd, getpath = 0; break; case 'v': - verbose = 1; + bconf_be_verbose(); break; case 'o': flags |= BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET; @@ -211,13 +211,11 @@ 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, " - "bytes_missing=%lu, cnt=%d, missed=%d\n", - ret, size, - (unsigned long)inodes->bytes_left, - (unsigned long)inodes->bytes_missing, - inodes->elem_cnt, inodes->elem_missed); + pr_verbose(1, +"ioctl ret=%d, total_size=%llu, bytes_left=%lu, bytes_missing=%lu, cnt=%d, missed=%d\n", + ret, size, (unsigned long)inodes->bytes_left, + (unsigned long)inodes->bytes_missing, inodes->elem_cnt, + inodes->elem_missed); bytes_left = sizeof(full_path); ret = snprintf(full_path, bytes_left, "%s/", argv[optind+1]); @@ -262,8 +260,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 {