From 44e190d25e419771e95ea854e20f908c59e8195c Mon Sep 17 00:00:00 2001 From: David Sterba Date: Wed, 17 Jul 2024 04:07:22 +0200 Subject: [PATCH] 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 --- cmds/inspect-tree-stats.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cmds/inspect-tree-stats.c b/cmds/inspect-tree-stats.c index 00536581..ca03f143 100644 --- a/cmds/inspect-tree-stats.c +++ b/cmds/inspect-tree-stats.c @@ -40,7 +40,6 @@ #include "cmds/commands.h" static int verbose = 0; -static bool no_pretty = false; struct seek { u64 distance; @@ -366,7 +365,7 @@ out_print: 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); @@ -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; @@ -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);