Skip to content

Commit

Permalink
btrfs-progs: tree-stats: unify setting raw/bytes options
Browse files Browse the repository at this point in the history
The long options now allow to pass the unit mode in the usual way, drop
the local variable for raw byte values.

Signed-off-by: David Sterba <[email protected]>
  • Loading branch information
kdave committed Jul 17, 2024
1 parent 5d92945 commit c94327d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cmds/inspect-tree-stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include "cmds/commands.h"

static int verbose = 0;
static bool no_pretty = false;

struct seek {
u64 distance;
Expand Down Expand Up @@ -366,7 +365,7 @@ static int calc_root_size(struct btrfs_root *tree_root, struct btrfs_key *key,
stat.total_clusters = 1;
}

if (no_pretty || size_fail) {
if (unit_mode == UNITS_RAW || size_fail) {
pr_verbose(LOG_DEFAULT, "\tTotal size: %llu\n", stat.total_bytes);
pr_verbose(LOG_DEFAULT, "\t\tInline data: %llu\n", stat.total_inline);
pr_verbose(LOG_DEFAULT, "\tTotal seeks: %llu\n", stat.total_seeks);
Expand Down Expand Up @@ -451,7 +450,7 @@ static int cmd_inspect_tree_stats(const struct cmd_struct *cmd,
{
struct btrfs_key key = { .type = BTRFS_ROOT_ITEM_KEY };
struct btrfs_root *root;
unsigned int unit_mode;
unsigned int unit_mode = UNITS_DEFAULT;
int opt;
int ret = 0;
u64 tree_id = 0;
Expand All @@ -465,7 +464,7 @@ static int cmd_inspect_tree_stats(const struct cmd_struct *cmd,
verbose++;
break;
case 'b':
no_pretty = true;
unit_mode = UNITS_RAW;
break;
case 't':
tree_id = arg_strtou64(optarg);
Expand Down

0 comments on commit c94327d

Please sign in to comment.