Skip to content

Commit 7cb3efb

Browse files
author
Darrick J. Wong
committed
xfs: rename m_ag_maxlevels to m_allocbt_maxlevels
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 <[email protected]> Reviewed-by: Dave Chinner <[email protected]>
1 parent c940a0c commit 7cb3efb

File tree

8 files changed

+22
-19
lines changed

8 files changed

+22
-19
lines changed

fs/xfs/libxfs/xfs_alloc.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2190,13 +2190,13 @@ xfs_free_ag_extent(
21902190
*/
21912191

21922192
/*
2193-
* Compute and fill in value of m_ag_maxlevels.
2193+
* Compute and fill in value of m_alloc_maxlevels.
21942194
*/
21952195
void
21962196
xfs_alloc_compute_maxlevels(
21972197
xfs_mount_t *mp) /* file system mount structure */
21982198
{
2199-
mp->m_ag_maxlevels = xfs_btree_compute_maxlevels(mp->m_alloc_mnr,
2199+
mp->m_alloc_maxlevels = xfs_btree_compute_maxlevels(mp->m_alloc_mnr,
22002200
(mp->m_sb.sb_agblocks + 1) / 2);
22012201
}
22022202

@@ -2255,14 +2255,14 @@ xfs_alloc_min_freelist(
22552255
const uint8_t *levels = pag ? pag->pagf_levels : fake_levels;
22562256
unsigned int min_free;
22572257

2258-
ASSERT(mp->m_ag_maxlevels > 0);
2258+
ASSERT(mp->m_alloc_maxlevels > 0);
22592259

22602260
/* space needed by-bno freespace btree */
22612261
min_free = min_t(unsigned int, levels[XFS_BTNUM_BNOi] + 1,
2262-
mp->m_ag_maxlevels);
2262+
mp->m_alloc_maxlevels);
22632263
/* space needed by-size freespace btree */
22642264
min_free += min_t(unsigned int, levels[XFS_BTNUM_CNTi] + 1,
2265-
mp->m_ag_maxlevels);
2265+
mp->m_alloc_maxlevels);
22662266
/* space needed reverse mapping used space btree */
22672267
if (xfs_has_rmapbt(mp))
22682268
min_free += min_t(unsigned int, levels[XFS_BTNUM_RMAPi] + 1,
@@ -2903,13 +2903,16 @@ xfs_agf_verify(
29032903

29042904
if (be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]) < 1 ||
29052905
be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]) < 1 ||
2906-
be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]) > mp->m_ag_maxlevels ||
2907-
be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]) > mp->m_ag_maxlevels)
2906+
be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]) >
2907+
mp->m_alloc_maxlevels ||
2908+
be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]) >
2909+
mp->m_alloc_maxlevels)
29082910
return __this_address;
29092911

29102912
if (xfs_has_rmapbt(mp) &&
29112913
(be32_to_cpu(agf->agf_levels[XFS_BTNUM_RMAP]) < 1 ||
2912-
be32_to_cpu(agf->agf_levels[XFS_BTNUM_RMAP]) > mp->m_rmap_maxlevels))
2914+
be32_to_cpu(agf->agf_levels[XFS_BTNUM_RMAP]) >
2915+
mp->m_rmap_maxlevels))
29132916
return __this_address;
29142917

29152918
if (xfs_has_rmapbt(mp) &&

fs/xfs/libxfs/xfs_alloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ unsigned int xfs_alloc_min_freelist(struct xfs_mount *mp,
9898
struct xfs_perag *pag);
9999

100100
/*
101-
* Compute and fill in value of m_ag_maxlevels.
101+
* Compute and fill in value of m_alloc_maxlevels.
102102
*/
103103
void
104104
xfs_alloc_compute_maxlevels(

fs/xfs/libxfs/xfs_alloc_btree.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ xfs_allocbt_verify(
316316
if (pag && pag->pagf_init) {
317317
if (level >= pag->pagf_levels[btnum])
318318
return __this_address;
319-
} else if (level >= mp->m_ag_maxlevels)
319+
} else if (level >= mp->m_alloc_maxlevels)
320320
return __this_address;
321321

322322
return xfs_btree_sblock_verify(bp, mp->m_alloc_mxr[level != 0]);
@@ -477,7 +477,7 @@ xfs_allocbt_init_common(
477477

478478
ASSERT(btnum == XFS_BTNUM_BNO || btnum == XFS_BTNUM_CNT);
479479

480-
cur = xfs_btree_alloc_cursor(mp, tp, btnum, mp->m_ag_maxlevels);
480+
cur = xfs_btree_alloc_cursor(mp, tp, btnum, mp->m_alloc_maxlevels);
481481
cur->bc_ag.abt.active = false;
482482

483483
if (btnum == XFS_BTNUM_CNT) {

fs/xfs/libxfs/xfs_trans_resv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ xfs_allocfree_log_count(
7070
{
7171
uint blocks;
7272

73-
blocks = num_ops * 2 * (2 * mp->m_ag_maxlevels - 1);
73+
blocks = num_ops * 2 * (2 * mp->m_alloc_maxlevels - 1);
7474
if (xfs_has_rmapbt(mp))
7575
blocks += num_ops * (2 * mp->m_rmap_maxlevels - 1);
7676
if (xfs_has_reflink(mp))

fs/xfs/libxfs/xfs_trans_space.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
#define XFS_DIOSTRAT_SPACE_RES(mp, v) \
7575
(XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK) + (v))
7676
#define XFS_GROWFS_SPACE_RES(mp) \
77-
(2 * (mp)->m_ag_maxlevels)
77+
(2 * (mp)->m_alloc_maxlevels)
7878
#define XFS_GROWFSRT_SPACE_RES(mp,b) \
7979
((b) + XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK))
8080
#define XFS_LINK_SPACE_RES(mp,nl) \

fs/xfs/scrub/agheader.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,11 +555,11 @@ xchk_agf(
555555
xchk_block_set_corrupt(sc, sc->sa.agf_bp);
556556

557557
level = be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]);
558-
if (level <= 0 || level > mp->m_ag_maxlevels)
558+
if (level <= 0 || level > mp->m_alloc_maxlevels)
559559
xchk_block_set_corrupt(sc, sc->sa.agf_bp);
560560

561561
level = be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]);
562-
if (level <= 0 || level > mp->m_ag_maxlevels)
562+
if (level <= 0 || level > mp->m_alloc_maxlevels)
563563
xchk_block_set_corrupt(sc, sc->sa.agf_bp);
564564

565565
if (xfs_has_rmapbt(mp)) {

fs/xfs/scrub/agheader_repair.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,12 @@ xrep_agf(
339339
[XREP_AGF_BNOBT] = {
340340
.rmap_owner = XFS_RMAP_OWN_AG,
341341
.buf_ops = &xfs_bnobt_buf_ops,
342-
.maxlevels = sc->mp->m_ag_maxlevels,
342+
.maxlevels = sc->mp->m_alloc_maxlevels,
343343
},
344344
[XREP_AGF_CNTBT] = {
345345
.rmap_owner = XFS_RMAP_OWN_AG,
346346
.buf_ops = &xfs_cntbt_buf_ops,
347-
.maxlevels = sc->mp->m_ag_maxlevels,
347+
.maxlevels = sc->mp->m_alloc_maxlevels,
348348
},
349349
[XREP_AGF_RMAPBT] = {
350350
.rmap_owner = XFS_RMAP_OWN_AG,

fs/xfs/xfs_mount.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ typedef struct xfs_mount {
128128
uint m_rmap_mnr[2]; /* min rmap btree records */
129129
uint m_refc_mxr[2]; /* max refc btree records */
130130
uint m_refc_mnr[2]; /* min refc btree records */
131-
uint m_ag_maxlevels; /* XFS_AG_MAXLEVELS */
132-
uint m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */
131+
uint m_alloc_maxlevels; /* max alloc btree levels */
132+
uint m_bm_maxlevels[2]; /* max bmap btree levels */
133133
uint m_rmap_maxlevels; /* max rmap btree levels */
134134
uint m_refc_maxlevels; /* max refcount btree level */
135135
xfs_extlen_t m_ag_prealloc_blocks; /* reserved ag blocks */

0 commit comments

Comments
 (0)