summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_alloc_btree.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-02-22 12:35:21 -0800
committerDarrick J. Wong <djwong@kernel.org>2024-02-22 12:35:21 -0800
commit07b7f2e3172b97da2a7ac273ecbaf173cc09a9f4 (patch)
tree36e7dad7ba7f84375744656e6565d80c9043a441 /fs/xfs/libxfs/xfs_alloc_btree.c
parent90cfae818dac5227e94e21d0f5250e098432723e (diff)
xfs: move the btree stats offset into struct btree_ops
The statistics offset is completely static, move it into the btree_ops structure instead of the cursor. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/libxfs/xfs_alloc_btree.c')
-rw-r--r--fs/xfs/libxfs/xfs_alloc_btree.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/xfs/libxfs/xfs_alloc_btree.c b/fs/xfs/libxfs/xfs_alloc_btree.c
index 045c7954ef1b..85ac0ba3c1f1 100644
--- a/fs/xfs/libxfs/xfs_alloc_btree.c
+++ b/fs/xfs/libxfs/xfs_alloc_btree.c
@@ -459,6 +459,7 @@ const struct xfs_btree_ops xfs_bnobt_ops = {
.key_len = sizeof(xfs_alloc_key_t),
.lru_refs = XFS_ALLOC_BTREE_REF,
+ .statoff = XFS_STATS_CALC_INDEX(xs_abtb_2),
.dup_cursor = xfs_allocbt_dup_cursor,
.set_root = xfs_allocbt_set_root,
@@ -486,6 +487,7 @@ const struct xfs_btree_ops xfs_cntbt_ops = {
.key_len = sizeof(xfs_alloc_key_t),
.lru_refs = XFS_ALLOC_BTREE_REF,
+ .statoff = XFS_STATS_CALC_INDEX(xs_abtc_2),
.dup_cursor = xfs_allocbt_dup_cursor,
.set_root = xfs_allocbt_set_root,
@@ -514,22 +516,17 @@ xfs_allocbt_init_common(
struct xfs_perag *pag,
xfs_btnum_t btnum)
{
+ const struct xfs_btree_ops *ops = &xfs_bnobt_ops;
struct xfs_btree_cur *cur;
ASSERT(btnum == XFS_BTNUM_BNO || btnum == XFS_BTNUM_CNT);
- if (btnum == XFS_BTNUM_CNT) {
- cur = xfs_btree_alloc_cursor(mp, tp, btnum, &xfs_cntbt_ops,
- mp->m_alloc_maxlevels, xfs_allocbt_cur_cache);
- cur->bc_statoff = XFS_STATS_CALC_INDEX(xs_abtc_2);
- } else {
- cur = xfs_btree_alloc_cursor(mp, tp, btnum, &xfs_bnobt_ops,
- mp->m_alloc_maxlevels, xfs_allocbt_cur_cache);
- cur->bc_statoff = XFS_STATS_CALC_INDEX(xs_abtb_2);
- }
+ if (btnum == XFS_BTNUM_CNT)
+ ops = &xfs_cntbt_ops;
+ cur = xfs_btree_alloc_cursor(mp, tp, btnum, ops, mp->m_alloc_maxlevels,
+ xfs_allocbt_cur_cache);
cur->bc_ag.pag = xfs_perag_hold(pag);
-
return cur;
}