Skip to content

Commit c94327d

Browse files
committed
btrfs-progs: tree-stats: unify setting raw/bytes options
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]>
1 parent 5d92945 commit c94327d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

cmds/inspect-tree-stats.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
#include "cmds/commands.h"
4141

4242
static int verbose = 0;
43-
static bool no_pretty = false;
4443

4544
struct seek {
4645
u64 distance;
@@ -366,7 +365,7 @@ static int calc_root_size(struct btrfs_root *tree_root, struct btrfs_key *key,
366365
stat.total_clusters = 1;
367366
}
368367

369-
if (no_pretty || size_fail) {
368+
if (unit_mode == UNITS_RAW || size_fail) {
370369
pr_verbose(LOG_DEFAULT, "\tTotal size: %llu\n", stat.total_bytes);
371370
pr_verbose(LOG_DEFAULT, "\t\tInline data: %llu\n", stat.total_inline);
372371
pr_verbose(LOG_DEFAULT, "\tTotal seeks: %llu\n", stat.total_seeks);
@@ -451,7 +450,7 @@ static int cmd_inspect_tree_stats(const struct cmd_struct *cmd,
451450
{
452451
struct btrfs_key key = { .type = BTRFS_ROOT_ITEM_KEY };
453452
struct btrfs_root *root;
454-
unsigned int unit_mode;
453+
unsigned int unit_mode = UNITS_DEFAULT;
455454
int opt;
456455
int ret = 0;
457456
u64 tree_id = 0;
@@ -465,7 +464,7 @@ static int cmd_inspect_tree_stats(const struct cmd_struct *cmd,
465464
verbose++;
466465
break;
467466
case 'b':
468-
no_pretty = true;
467+
unit_mode = UNITS_RAW;
469468
break;
470469
case 't':
471470
tree_id = arg_strtou64(optarg);

0 commit comments

Comments
 (0)