aboutsummaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_ialloc_btree.c
diff options
context:
space:
mode:
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;
}