[PATCH 01/27] libxfs: compute the rt rmap btree maxlevels during initialization

Darrick J. Wong
2025-02-06T22:50:00Z

Compute max rt rmap btree height information when we set up libxfs.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
libxfs/init.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/libxfs/init.c b/libxfs/init.c
index 16291466ac86d3..02a4cfdf38b198 100644
--- a/libxfs/init.c
+++ b/libxfs/init.c
@@ -21,6 +21,7 @@
#include "xfs_trans.h"
#include "xfs_rmap_btree.h"
#include "xfs_refcount_btree.h"
+#include "xfs_metafile.h"
#include "libfrog/platform.h"
#include "libfrog/util.h"
#include "libxfs/xfile.h"
@@ -598,6 +599,14 @@ xfs_agbtree_compute_maxlevels(
mp->m_agbtree_maxlevels = max(levels, mp->m_refc_maxlevels);
}

+/* Compute maximum possible height for realtime btree types for this fs. */
+static inline void
+xfs_rtbtree_compute_maxlevels(
+ struct xfs_mount *mp)
+{
+ mp->m_rtbtree_maxlevels = mp->m_rtrmap_maxlevels;
+}
+
/* Compute maximum possible height of all btrees. */
void
libxfs_compute_all_maxlevels(
@@ -611,10 +620,11 @@ libxfs_compute_all_maxlevels(
igeo->attr_fork_offset = xfs_bmap_compute_attr_offset(mp);
xfs_ialloc_setup_geometry(mp);
xfs_rmapbt_compute_maxlevels(mp);
+ xfs_rtrmapbt_compute_maxlevels(mp);
xfs_refcountbt_compute_maxlevels(mp);

xfs_agbtree_compute_maxlevels(mp);
-
+ xfs_rtbtree_compute_maxlevels(mp);
}

/* Mount the metadata files under the metadata directory tree. */