[PATCH v1 2/7] xfs: Introduce helpers to count the number of bitmap and summary inodes

Nirjhar Roy (IBM)
2026-02-19T06:11:55Z

From: "Nirjhar Roy (IBM)" <nirjhar.roy.lists@gmail.com>

With -metadir=1, we need some helpers that will count the number of
bitmap and summary inodes for realtime XFS. This will be used in
the tests for upcoming patches.

Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
---
common/xfs | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/common/xfs b/common/xfs
index 8e4425b4..87839265 100644
--- a/common/xfs
+++ b/common/xfs
@@ -1375,6 +1375,18 @@ _require_no_xfs_always_cow()
fi
}

+# Counts number of bitmap files present in the metadata directory
+_scratch_xfs_get_rt_bitmap_count()
+{
+ _scratch_xfs_db -r -c "ls -m /rtgroups" | grep "\.bitmap" | wc -l
+}
+
+# Counts number of summary files present in the metadata directory
+_scratch_xfs_get_rt_summary_count()
+{
+ _scratch_xfs_db -r -c "ls -m /rtgroups" | grep "\.summary" | wc -l
+}
+
# Get a metadata field
# The first arg is the field name
# The rest of the arguments are xfs_db commands to find the metadata.
--
2.34.1