Merge tag 'sound-5.16-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
[linux-2.6-microblaze.git] / fs / xfs / xfs_mount.c
index 06dac09..359109b 100644 (file)
@@ -567,6 +567,18 @@ xfs_mount_setup_inode_geom(
        xfs_ialloc_setup_geometry(mp);
 }
 
+/* Compute maximum possible height for per-AG btree types for this fs. */
+static inline void
+xfs_agbtree_compute_maxlevels(
+       struct xfs_mount        *mp)
+{
+       unsigned int            levels;
+
+       levels = max(mp->m_alloc_maxlevels, M_IGEO(mp)->inobt_maxlevels);
+       levels = max(levels, mp->m_rmap_maxlevels);
+       mp->m_agbtree_maxlevels = max(levels, mp->m_refc_maxlevels);
+}
+
 /*
  * This function does the following on an initial mount of a file system:
  *     - reads the superblock from disk and init the mount struct
@@ -638,6 +650,8 @@ xfs_mountfs(
        xfs_rmapbt_compute_maxlevels(mp);
        xfs_refcountbt_compute_maxlevels(mp);
 
+       xfs_agbtree_compute_maxlevels(mp);
+
        /*
         * Check if sb_agblocks is aligned at stripe boundary.  If sb_agblocks
         * is NOT aligned turn off m_dalign since allocator alignment is within