xfs: rename m_ag_maxlevels to m_allocbt_maxlevels
authorDarrick J. Wong <djwong@kernel.org>
Wed, 13 Oct 2021 17:02:19 +0000 (10:02 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 19 Oct 2021 18:45:15 +0000 (11:45 -0700)
Years ago when XFS was thought to be much more simple, we introduced
m_ag_maxlevels to specify the maximum btree height of per-AG btrees for
a given filesystem mount.  Then we observed that inode btrees don't
actually have the same height and split that off; and now we have rmap
and refcount btrees with much different geometries and separate
maxlevels variables.

The 'ag' part of the name doesn't make much sense anymore, so rename
this to m_alloc_maxlevels to reinforce that this is the maximum height
of the *free space* btrees.  This sets us up for the next patch, which
will add a variable to track the maximum height of all AG btrees.

(Also take the opportunity to improve adjacent comments and fix minor
style problems.)

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/libxfs/xfs_alloc.c
fs/xfs/libxfs/xfs_alloc.h
fs/xfs/libxfs/xfs_alloc_btree.c
fs/xfs/libxfs/xfs_trans_resv.c
fs/xfs/libxfs/xfs_trans_space.h
fs/xfs/scrub/agheader.c
fs/xfs/scrub/agheader_repair.c
fs/xfs/xfs_mount.h

index 55c5adc9b54e91bab8fbcef276332332785f908e..2efb4f4539f12305b66f4b3e2264b426819ba584 100644 (file)
@@ -2190,13 +2190,13 @@ xfs_free_ag_extent(
  */
 
 /*
- * Compute and fill in value of m_ag_maxlevels.
+ * Compute and fill in value of m_alloc_maxlevels.
  */
 void
 xfs_alloc_compute_maxlevels(
        xfs_mount_t     *mp)    /* file system mount structure */
 {
-       mp->m_ag_maxlevels = xfs_btree_compute_maxlevels(mp->m_alloc_mnr,
+       mp->m_alloc_maxlevels = xfs_btree_compute_maxlevels(mp->m_alloc_mnr,
                        (mp->m_sb.sb_agblocks + 1) / 2);
 }
 
@@ -2255,14 +2255,14 @@ xfs_alloc_min_freelist(
        const uint8_t           *levels = pag ? pag->pagf_levels : fake_levels;
        unsigned int            min_free;
 
-       ASSERT(mp->m_ag_maxlevels > 0);
+       ASSERT(mp->m_alloc_maxlevels > 0);
 
        /* space needed by-bno freespace btree */
        min_free = min_t(unsigned int, levels[XFS_BTNUM_BNOi] + 1,
-                                      mp->m_ag_maxlevels);
+                                      mp->m_alloc_maxlevels);
        /* space needed by-size freespace btree */
        min_free += min_t(unsigned int, levels[XFS_BTNUM_CNTi] + 1,
-                                      mp->m_ag_maxlevels);
+                                      mp->m_alloc_maxlevels);
        /* space needed reverse mapping used space btree */
        if (xfs_has_rmapbt(mp))
                min_free += min_t(unsigned int, levels[XFS_BTNUM_RMAPi] + 1,
@@ -2903,13 +2903,16 @@ xfs_agf_verify(
 
        if (be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]) < 1 ||
            be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]) < 1 ||
-           be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]) > mp->m_ag_maxlevels ||
-           be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]) > mp->m_ag_maxlevels)
+           be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]) >
+                                               mp->m_alloc_maxlevels ||
+           be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]) >
+                                               mp->m_alloc_maxlevels)
                return __this_address;
 
        if (xfs_has_rmapbt(mp) &&
            (be32_to_cpu(agf->agf_levels[XFS_BTNUM_RMAP]) < 1 ||
-            be32_to_cpu(agf->agf_levels[XFS_BTNUM_RMAP]) > mp->m_rmap_maxlevels))
+            be32_to_cpu(agf->agf_levels[XFS_BTNUM_RMAP]) >
+                                               mp->m_rmap_maxlevels))
                return __this_address;
 
        if (xfs_has_rmapbt(mp) &&
index df4aefaf0046e818b49a87b1fdc35b2a00398de9..2f3f8c2e08600240fcc86db6fbf82137a25b063d 100644 (file)
@@ -98,7 +98,7 @@ unsigned int xfs_alloc_min_freelist(struct xfs_mount *mp,
                struct xfs_perag *pag);
 
 /*
- * Compute and fill in value of m_ag_maxlevels.
+ * Compute and fill in value of m_alloc_maxlevels.
  */
 void
 xfs_alloc_compute_maxlevels(
index f14bad21503fe329cbcbf487afc9945772d06c44..c3e262290f6fe8aba01d8db72326c32fcbf0554a 100644 (file)
@@ -316,7 +316,7 @@ xfs_allocbt_verify(
        if (pag && pag->pagf_init) {
                if (level >= pag->pagf_levels[btnum])
                        return __this_address;
-       } else if (level >= mp->m_ag_maxlevels)
+       } else if (level >= mp->m_alloc_maxlevels)
                return __this_address;
 
        return xfs_btree_sblock_verify(bp, mp->m_alloc_mxr[level != 0]);
@@ -477,7 +477,7 @@ xfs_allocbt_init_common(
 
        ASSERT(btnum == XFS_BTNUM_BNO || btnum == XFS_BTNUM_CNT);
 
-       cur = xfs_btree_alloc_cursor(mp, tp, btnum, mp->m_ag_maxlevels);
+       cur = xfs_btree_alloc_cursor(mp, tp, btnum, mp->m_alloc_maxlevels);
        cur->bc_ag.abt.active = false;
 
        if (btnum == XFS_BTNUM_CNT) {
index 5e300daa255931532915905270506a0948d70e80..c879e7754ee6fbc3c57aa1d06c33f10164b65796 100644 (file)
@@ -70,7 +70,7 @@ xfs_allocfree_log_count(
 {
        uint            blocks;
 
-       blocks = num_ops * 2 * (2 * mp->m_ag_maxlevels - 1);
+       blocks = num_ops * 2 * (2 * mp->m_alloc_maxlevels - 1);
        if (xfs_has_rmapbt(mp))
                blocks += num_ops * (2 * mp->m_rmap_maxlevels - 1);
        if (xfs_has_reflink(mp))
index 50332be343881e88c8211087741450ae480efd9b..bd04cb836419ebbea52f2d7c9a23ba6e1dff8ff0 100644 (file)
@@ -74,7 +74,7 @@
 #define        XFS_DIOSTRAT_SPACE_RES(mp, v)   \
        (XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK) + (v))
 #define        XFS_GROWFS_SPACE_RES(mp)        \
-       (2 * (mp)->m_ag_maxlevels)
+       (2 * (mp)->m_alloc_maxlevels)
 #define        XFS_GROWFSRT_SPACE_RES(mp,b)    \
        ((b) + XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK))
 #define        XFS_LINK_SPACE_RES(mp,nl)       \
index a2c3af77b6c25f3e67bf7108f30b1f313c55bf68..bed798792226aac1fead954000b3ee89004223ec 100644 (file)
@@ -555,11 +555,11 @@ xchk_agf(
                xchk_block_set_corrupt(sc, sc->sa.agf_bp);
 
        level = be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]);
-       if (level <= 0 || level > mp->m_ag_maxlevels)
+       if (level <= 0 || level > mp->m_alloc_maxlevels)
                xchk_block_set_corrupt(sc, sc->sa.agf_bp);
 
        level = be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]);
-       if (level <= 0 || level > mp->m_ag_maxlevels)
+       if (level <= 0 || level > mp->m_alloc_maxlevels)
                xchk_block_set_corrupt(sc, sc->sa.agf_bp);
 
        if (xfs_has_rmapbt(mp)) {
index 05c27149b65dbb1306a1f01d9e555496749ba0e8..d7bfed52f4cd64a5567b083b251b6eb3eee79ee9 100644 (file)
@@ -339,12 +339,12 @@ xrep_agf(
                [XREP_AGF_BNOBT] = {
                        .rmap_owner = XFS_RMAP_OWN_AG,
                        .buf_ops = &xfs_bnobt_buf_ops,
-                       .maxlevels = sc->mp->m_ag_maxlevels,
+                       .maxlevels = sc->mp->m_alloc_maxlevels,
                },
                [XREP_AGF_CNTBT] = {
                        .rmap_owner = XFS_RMAP_OWN_AG,
                        .buf_ops = &xfs_cntbt_buf_ops,
-                       .maxlevels = sc->mp->m_ag_maxlevels,
+                       .maxlevels = sc->mp->m_alloc_maxlevels,
                },
                [XREP_AGF_RMAPBT] = {
                        .rmap_owner = XFS_RMAP_OWN_AG,
index e091f3b3fa15820b6f63b7fcbc5687f3f7e3007b..e4b7a8eb0d06d0e8f6b8fd3b29c1f91dfa6bf8f1 100644 (file)
@@ -128,8 +128,8 @@ typedef struct xfs_mount {
        uint                    m_rmap_mnr[2];  /* min rmap btree records */
        uint                    m_refc_mxr[2];  /* max refc btree records */
        uint                    m_refc_mnr[2];  /* min refc btree records */
-       uint                    m_ag_maxlevels; /* XFS_AG_MAXLEVELS */
-       uint                    m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */
+       uint                    m_alloc_maxlevels; /* max alloc btree levels */
+       uint                    m_bm_maxlevels[2]; /* max bmap btree levels */
        uint                    m_rmap_maxlevels; /* max rmap btree levels */
        uint                    m_refc_maxlevels; /* max refcount btree level */
        xfs_extlen_t            m_ag_prealloc_blocks; /* reserved ag blocks */