summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_ialloc_btree.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-02-22 23:35:21 +0300
committerDarrick J. Wong <djwong@kernel.org>2024-02-22 23:35:21 +0300
commit07b7f2e3172b97da2a7ac273ecbaf173cc09a9f4 (patch)
tree36e7dad7ba7f84375744656e6565d80c9043a441 /fs/xfs/libxfs/xfs_ialloc_btree.c
parent90cfae818dac5227e94e21d0f5250e098432723e (diff)
downloadlinux-07b7f2e3172b97da2a7ac273ecbaf173cc09a9f4.tar.xz
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_ialloc_btree.c')
-rw-r--r--fs/xfs/libxfs/xfs_ialloc_btree.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/fs/xfs/libxfs/xfs_ialloc_btree.c b/fs/xfs/libxfs/xfs_ialloc_btree.c
index a2a8c15a6c9e..8ac789650106 100644
--- a/fs/xfs/libxfs/xfs_ialloc_btree.c
+++ b/fs/xfs/libxfs/xfs_ialloc_btree.c
@@ -403,6 +403,7 @@ const struct xfs_btree_ops xfs_inobt_ops = {
.key_len = sizeof(xfs_inobt_key_t),
.lru_refs = XFS_INO_BTREE_REF,
+ .statoff = XFS_STATS_CALC_INDEX(xs_ibt_2),
.dup_cursor = xfs_inobt_dup_cursor,
.set_root = xfs_inobt_set_root,
@@ -427,6 +428,7 @@ const struct xfs_btree_ops xfs_finobt_ops = {
.key_len = sizeof(xfs_inobt_key_t),
.lru_refs = XFS_INO_BTREE_REF,
+ .statoff = XFS_STATS_CALC_INDEX(xs_fibt_2),
.dup_cursor = xfs_inobt_dup_cursor,
.set_root = xfs_finobt_set_root,
@@ -456,20 +458,16 @@ xfs_inobt_init_common(
xfs_btnum_t btnum) /* ialloc or free ino btree */
{
struct xfs_mount *mp = pag->pag_mount;
+ const struct xfs_btree_ops *ops = &xfs_inobt_ops;
struct xfs_btree_cur *cur;
- if (btnum == XFS_BTNUM_INO) {
- cur = xfs_btree_alloc_cursor(mp, tp, btnum, &xfs_inobt_ops,
- M_IGEO(mp)->inobt_maxlevels,
- xfs_inobt_cur_cache);
- cur->bc_statoff = XFS_STATS_CALC_INDEX(xs_ibt_2);
- } else {
- cur = xfs_btree_alloc_cursor(mp, tp, btnum, &xfs_finobt_ops,
- M_IGEO(mp)->inobt_maxlevels,
- xfs_inobt_cur_cache);
- cur->bc_statoff = XFS_STATS_CALC_INDEX(xs_fibt_2);
- }
+ ASSERT(btnum == XFS_BTNUM_INO || btnum == XFS_BTNUM_FINO);
+
+ if (btnum == XFS_BTNUM_FINO)
+ ops = &xfs_finobt_ops;
+ cur = xfs_btree_alloc_cursor(mp, tp, btnum, ops,
+ M_IGEO(mp)->inobt_maxlevels, xfs_inobt_cur_cache);
cur->bc_ag.pag = xfs_perag_hold(pag);
return cur;
}