xfs_db: support computing btheight for all cursor types
Add the special magic btree type value 'all' to the btheight command so
that we can display information about all known btree types at once.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
diff --git a/db/btheight.c b/db/btheight.c
index 22fe0cc..0e6fa58 100644
--- a/db/btheight.c
+++ b/db/btheight.c
@@ -47,7 +47,7 @@
" -w min -- Show only the worst case scenario.\n"
"\n"
" Supported btree types:\n"
-" "
+" all "
));
for (i = 0, m = maps; i < ARRAY_SIZE(maps); i++, m++)
printf("%s ", m->tag);
@@ -97,7 +97,7 @@
static int
construct_records_per_block(
- char *tag,
+ const char *tag,
int blocksize,
unsigned int *records_per_block)
{
@@ -225,7 +225,7 @@
static void
report(
- char *tag,
+ const char *tag,
unsigned int report_what,
unsigned long long nr_records,
unsigned int blocksize)
@@ -287,6 +287,19 @@
}
}
+static void
+report_all(
+ unsigned int report_what,
+ unsigned long long nr_records,
+ unsigned int blocksize)
+{
+ struct btmap *m;
+ int i;
+
+ for (i = 0, m = maps; i < ARRAY_SIZE(maps); i++, m++)
+ report(m->tag, report_what, nr_records, blocksize);
+}
+
static int
btheight_f(
int argc,
@@ -356,6 +369,13 @@
return 0;
}
+ for (i = optind; i < argc; i++) {
+ if (!strcmp(argv[i], "all")) {
+ report_all(report_what, nr_records, blocksize);
+ return 0;
+ }
+ }
+
for (i = optind; i < argc; i++)
report(argv[i], report_what, nr_records, blocksize);
diff --git a/man/man8/xfs_db.8 b/man/man8/xfs_db.8
index 45d6dcf..307f4a0 100644
--- a/man/man8/xfs_db.8
+++ b/man/man8/xfs_db.8
@@ -420,6 +420,9 @@
.IR refcountbt ,
and
.IR rmapbt .
+The magic value
+.I all
+can be used to walk through all btree types.
Options are as follows:
.RS 1.0i