summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_ialloc_btree.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2021-06-02 10:48:24 +1000
committerDave Chinner <david@fromorbit.com>2021-06-02 10:48:24 +1000
commitbe9fb17d88f08af648a89784d30dbac83d893154 (patch)
tree7609c3af495c79f3d2c183b1f9e9cfdc4cde38a8 /fs/xfs/libxfs/xfs_ialloc_btree.c
parent58d43a7e3263766ade4974c86118e6b5737ea259 (diff)
xfs: add a perag to the btree cursor
Which will eventually completely replace the agno in it. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Brian Foster <bfoster@redhat.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_ialloc_btree.c')
-rw-r--r--fs/xfs/libxfs/xfs_ialloc_btree.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/fs/xfs/libxfs/xfs_ialloc_btree.c b/fs/xfs/libxfs/xfs_ialloc_btree.c
index 4ec8ea1331a5..6c4efdf01674 100644
--- a/fs/xfs/libxfs/xfs_ialloc_btree.c
+++ b/fs/xfs/libxfs/xfs_ialloc_btree.c
@@ -36,7 +36,7 @@ xfs_inobt_dup_cursor(
{
return xfs_inobt_init_cursor(cur->bc_mp, cur->bc_tp,
cur->bc_ag.agbp, cur->bc_ag.agno,
- cur->bc_btnum);
+ cur->bc_ag.pag, cur->bc_btnum);
}
STATIC void
@@ -429,6 +429,7 @@ xfs_inobt_init_common(
struct xfs_mount *mp, /* file system mount point */
struct xfs_trans *tp, /* transaction pointer */
xfs_agnumber_t agno, /* allocation group number */
+ struct xfs_perag *pag,
xfs_btnum_t btnum) /* ialloc or free ino btree */
{
struct xfs_btree_cur *cur;
@@ -451,6 +452,11 @@ xfs_inobt_init_common(
cur->bc_flags |= XFS_BTREE_CRC_BLOCKS;
cur->bc_ag.agno = agno;
+ if (pag) {
+ /* take a reference for the cursor */
+ atomic_inc(&pag->pag_ref);
+ }
+ cur->bc_ag.pag = pag;
return cur;
}
@@ -461,12 +467,13 @@ xfs_inobt_init_cursor(
struct xfs_trans *tp,
struct xfs_buf *agbp,
xfs_agnumber_t agno,
+ struct xfs_perag *pag,
xfs_btnum_t btnum)
{
struct xfs_btree_cur *cur;
struct xfs_agi *agi = agbp->b_addr;
- cur = xfs_inobt_init_common(mp, tp, agno, btnum);
+ cur = xfs_inobt_init_common(mp, tp, agno, pag, btnum);
if (btnum == XFS_BTNUM_INO)
cur->bc_nlevels = be32_to_cpu(agi->agi_level);
else
@@ -485,7 +492,7 @@ xfs_inobt_stage_cursor(
{
struct xfs_btree_cur *cur;
- cur = xfs_inobt_init_common(mp, NULL, agno, btnum);
+ cur = xfs_inobt_init_common(mp, NULL, agno, NULL, btnum);
xfs_btree_stage_afakeroot(cur, afake);
return cur;
}
@@ -672,7 +679,7 @@ xfs_inobt_cur(
if (error)
return error;
- cur = xfs_inobt_init_cursor(mp, tp, *agi_bpp, agno, which);
+ cur = xfs_inobt_init_cursor(mp, tp, *agi_bpp, agno, NULL, which);
*curpp = cur;
return 0;
}