mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-24 15:12:47 +00:00
btrfs-progs: inspect logical-resolve: add global verbose option
Propagate global --verbose option down to the btrfs inspect-internal logical-resolve subcommand. Command 'btrfs inspect-internal logical-resolve' provides local verbose option this patch makes it enable-able by using the global --verbose option. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
32544f4b7e
commit
6d022e7af2
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user