Commit 50f02fe3 authored by Dave Chinner's avatar Dave Chinner Committed by Dave Chinner

xfs: remove agno from btree cursor

Now that everything passes a perag, the agno is not needed anymore.
Convert all the users to use pag->pag_agno instead and remove the
agno from the cursor. This was largely done as an automated search
and replace.
Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
parent 7b13c515
...@@ -230,7 +230,7 @@ xfs_alloc_get_rec( ...@@ -230,7 +230,7 @@ xfs_alloc_get_rec(
int *stat) /* output: success/failure */ int *stat) /* output: success/failure */
{ {
struct xfs_mount *mp = cur->bc_mp; struct xfs_mount *mp = cur->bc_mp;
xfs_agnumber_t agno = cur->bc_ag.agno; xfs_agnumber_t agno = cur->bc_ag.pag->pag_agno;
union xfs_btree_rec *rec; union xfs_btree_rec *rec;
int error; int error;
......
...@@ -497,7 +497,6 @@ xfs_allocbt_init_common( ...@@ -497,7 +497,6 @@ xfs_allocbt_init_common(
/* take a reference for the cursor */ /* take a reference for the cursor */
atomic_inc(&pag->pag_ref); atomic_inc(&pag->pag_ref);
cur->bc_ag.pag = pag; cur->bc_ag.pag = pag;
cur->bc_ag.agno = pag->pag_agno;
if (xfs_sb_version_hascrc(&mp->m_sb)) if (xfs_sb_version_hascrc(&mp->m_sb))
cur->bc_flags |= XFS_BTREE_CRC_BLOCKS; cur->bc_flags |= XFS_BTREE_CRC_BLOCKS;
......
...@@ -216,7 +216,7 @@ xfs_btree_check_sptr( ...@@ -216,7 +216,7 @@ xfs_btree_check_sptr(
{ {
if (level <= 0) if (level <= 0)
return false; return false;
return xfs_verify_agbno(cur->bc_mp, cur->bc_ag.agno, agbno); return xfs_verify_agbno(cur->bc_mp, cur->bc_ag.pag->pag_agno, agbno);
} }
/* /*
...@@ -245,7 +245,7 @@ xfs_btree_check_ptr( ...@@ -245,7 +245,7 @@ xfs_btree_check_ptr(
return 0; return 0;
xfs_err(cur->bc_mp, xfs_err(cur->bc_mp,
"AG %u: Corrupt btree %d pointer at level %d index %d.", "AG %u: Corrupt btree %d pointer at level %d index %d.",
cur->bc_ag.agno, cur->bc_btnum, cur->bc_ag.pag->pag_agno, cur->bc_btnum,
level, index); level, index);
} }
...@@ -888,13 +888,13 @@ xfs_btree_readahead_sblock( ...@@ -888,13 +888,13 @@ xfs_btree_readahead_sblock(
if ((lr & XFS_BTCUR_LEFTRA) && left != NULLAGBLOCK) { if ((lr & XFS_BTCUR_LEFTRA) && left != NULLAGBLOCK) {
xfs_btree_reada_bufs(cur->bc_mp, cur->bc_ag.agno, xfs_btree_reada_bufs(cur->bc_mp, cur->bc_ag.pag->pag_agno,
left, 1, cur->bc_ops->buf_ops); left, 1, cur->bc_ops->buf_ops);
rval++; rval++;
} }
if ((lr & XFS_BTCUR_RIGHTRA) && right != NULLAGBLOCK) { if ((lr & XFS_BTCUR_RIGHTRA) && right != NULLAGBLOCK) {
xfs_btree_reada_bufs(cur->bc_mp, cur->bc_ag.agno, xfs_btree_reada_bufs(cur->bc_mp, cur->bc_ag.pag->pag_agno,
right, 1, cur->bc_ops->buf_ops); right, 1, cur->bc_ops->buf_ops);
rval++; rval++;
} }
...@@ -952,7 +952,7 @@ xfs_btree_ptr_to_daddr( ...@@ -952,7 +952,7 @@ xfs_btree_ptr_to_daddr(
*daddr = XFS_FSB_TO_DADDR(cur->bc_mp, fsbno); *daddr = XFS_FSB_TO_DADDR(cur->bc_mp, fsbno);
} else { } else {
agbno = be32_to_cpu(ptr->s); agbno = be32_to_cpu(ptr->s);
*daddr = XFS_AGB_TO_DADDR(cur->bc_mp, cur->bc_ag.agno, *daddr = XFS_AGB_TO_DADDR(cur->bc_mp, cur->bc_ag.pag->pag_agno,
agbno); agbno);
} }
...@@ -1153,7 +1153,7 @@ xfs_btree_init_block_cur( ...@@ -1153,7 +1153,7 @@ xfs_btree_init_block_cur(
if (cur->bc_flags & XFS_BTREE_LONG_PTRS) if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
owner = cur->bc_ino.ip->i_ino; owner = cur->bc_ino.ip->i_ino;
else else
owner = cur->bc_ag.agno; owner = cur->bc_ag.pag->pag_agno;
xfs_btree_init_block_int(cur->bc_mp, XFS_BUF_TO_BLOCK(bp), bp->b_bn, xfs_btree_init_block_int(cur->bc_mp, XFS_BUF_TO_BLOCK(bp), bp->b_bn,
cur->bc_btnum, level, numrecs, cur->bc_btnum, level, numrecs,
......
...@@ -181,7 +181,6 @@ union xfs_btree_irec { ...@@ -181,7 +181,6 @@ union xfs_btree_irec {
/* Per-AG btree information. */ /* Per-AG btree information. */
struct xfs_btree_cur_ag { struct xfs_btree_cur_ag {
xfs_agnumber_t agno;
struct xfs_perag *pag; struct xfs_perag *pag;
union { union {
struct xfs_buf *agbp; struct xfs_buf *agbp;
......
...@@ -105,7 +105,7 @@ xfs_inobt_get_rec( ...@@ -105,7 +105,7 @@ xfs_inobt_get_rec(
int *stat) int *stat)
{ {
struct xfs_mount *mp = cur->bc_mp; struct xfs_mount *mp = cur->bc_mp;
xfs_agnumber_t agno = cur->bc_ag.agno; xfs_agnumber_t agno = cur->bc_ag.pag->pag_agno;
union xfs_btree_rec *rec; union xfs_btree_rec *rec;
int error; int error;
uint64_t realfree; uint64_t realfree;
......
...@@ -102,7 +102,7 @@ __xfs_inobt_alloc_block( ...@@ -102,7 +102,7 @@ __xfs_inobt_alloc_block(
args.tp = cur->bc_tp; args.tp = cur->bc_tp;
args.mp = cur->bc_mp; args.mp = cur->bc_mp;
args.oinfo = XFS_RMAP_OINFO_INOBT; args.oinfo = XFS_RMAP_OINFO_INOBT;
args.fsbno = XFS_AGB_TO_FSB(args.mp, cur->bc_ag.agno, sbno); args.fsbno = XFS_AGB_TO_FSB(args.mp, cur->bc_ag.pag->pag_agno, sbno);
args.minlen = 1; args.minlen = 1;
args.maxlen = 1; args.maxlen = 1;
args.prod = 1; args.prod = 1;
...@@ -235,7 +235,7 @@ xfs_inobt_init_ptr_from_cur( ...@@ -235,7 +235,7 @@ xfs_inobt_init_ptr_from_cur(
{ {
struct xfs_agi *agi = cur->bc_ag.agbp->b_addr; struct xfs_agi *agi = cur->bc_ag.agbp->b_addr;
ASSERT(cur->bc_ag.agno == be32_to_cpu(agi->agi_seqno)); ASSERT(cur->bc_ag.pag->pag_agno == be32_to_cpu(agi->agi_seqno));
ptr->s = agi->agi_root; ptr->s = agi->agi_root;
} }
...@@ -247,7 +247,7 @@ xfs_finobt_init_ptr_from_cur( ...@@ -247,7 +247,7 @@ xfs_finobt_init_ptr_from_cur(
{ {
struct xfs_agi *agi = cur->bc_ag.agbp->b_addr; struct xfs_agi *agi = cur->bc_ag.agbp->b_addr;
ASSERT(cur->bc_ag.agno == be32_to_cpu(agi->agi_seqno)); ASSERT(cur->bc_ag.pag->pag_agno == be32_to_cpu(agi->agi_seqno));
ptr->s = agi->agi_free_root; ptr->s = agi->agi_free_root;
} }
...@@ -452,7 +452,6 @@ xfs_inobt_init_common( ...@@ -452,7 +452,6 @@ xfs_inobt_init_common(
/* take a reference for the cursor */ /* take a reference for the cursor */
atomic_inc(&pag->pag_ref); atomic_inc(&pag->pag_ref);
cur->bc_ag.pag = pag; cur->bc_ag.pag = pag;
cur->bc_ag.agno = pag->pag_agno;
return cur; return cur;
} }
......
...@@ -47,7 +47,7 @@ xfs_refcount_lookup_le( ...@@ -47,7 +47,7 @@ xfs_refcount_lookup_le(
xfs_agblock_t bno, xfs_agblock_t bno,
int *stat) int *stat)
{ {
trace_xfs_refcount_lookup(cur->bc_mp, cur->bc_ag.agno, bno, trace_xfs_refcount_lookup(cur->bc_mp, cur->bc_ag.pag->pag_agno, bno,
XFS_LOOKUP_LE); XFS_LOOKUP_LE);
cur->bc_rec.rc.rc_startblock = bno; cur->bc_rec.rc.rc_startblock = bno;
cur->bc_rec.rc.rc_blockcount = 0; cur->bc_rec.rc.rc_blockcount = 0;
...@@ -64,7 +64,7 @@ xfs_refcount_lookup_ge( ...@@ -64,7 +64,7 @@ xfs_refcount_lookup_ge(
xfs_agblock_t bno, xfs_agblock_t bno,
int *stat) int *stat)
{ {
trace_xfs_refcount_lookup(cur->bc_mp, cur->bc_ag.agno, bno, trace_xfs_refcount_lookup(cur->bc_mp, cur->bc_ag.pag->pag_agno, bno,
XFS_LOOKUP_GE); XFS_LOOKUP_GE);
cur->bc_rec.rc.rc_startblock = bno; cur->bc_rec.rc.rc_startblock = bno;
cur->bc_rec.rc.rc_blockcount = 0; cur->bc_rec.rc.rc_blockcount = 0;
...@@ -81,7 +81,7 @@ xfs_refcount_lookup_eq( ...@@ -81,7 +81,7 @@ xfs_refcount_lookup_eq(
xfs_agblock_t bno, xfs_agblock_t bno,
int *stat) int *stat)
{ {
trace_xfs_refcount_lookup(cur->bc_mp, cur->bc_ag.agno, bno, trace_xfs_refcount_lookup(cur->bc_mp, cur->bc_ag.pag->pag_agno, bno,
XFS_LOOKUP_LE); XFS_LOOKUP_LE);
cur->bc_rec.rc.rc_startblock = bno; cur->bc_rec.rc.rc_startblock = bno;
cur->bc_rec.rc.rc_blockcount = 0; cur->bc_rec.rc.rc_blockcount = 0;
...@@ -109,7 +109,7 @@ xfs_refcount_get_rec( ...@@ -109,7 +109,7 @@ xfs_refcount_get_rec(
int *stat) int *stat)
{ {
struct xfs_mount *mp = cur->bc_mp; struct xfs_mount *mp = cur->bc_mp;
xfs_agnumber_t agno = cur->bc_ag.agno; xfs_agnumber_t agno = cur->bc_ag.pag->pag_agno;
union xfs_btree_rec *rec; union xfs_btree_rec *rec;
int error; int error;
xfs_agblock_t realstart; xfs_agblock_t realstart;
...@@ -120,7 +120,7 @@ xfs_refcount_get_rec( ...@@ -120,7 +120,7 @@ xfs_refcount_get_rec(
xfs_refcount_btrec_to_irec(rec, irec); xfs_refcount_btrec_to_irec(rec, irec);
agno = cur->bc_ag.agno; agno = cur->bc_ag.pag->pag_agno;
if (irec->rc_blockcount == 0 || irec->rc_blockcount > MAXREFCEXTLEN) if (irec->rc_blockcount == 0 || irec->rc_blockcount > MAXREFCEXTLEN)
goto out_bad_rec; goto out_bad_rec;
...@@ -145,7 +145,7 @@ xfs_refcount_get_rec( ...@@ -145,7 +145,7 @@ xfs_refcount_get_rec(
if (irec->rc_refcount == 0 || irec->rc_refcount > MAXREFCOUNT) if (irec->rc_refcount == 0 || irec->rc_refcount > MAXREFCOUNT)
goto out_bad_rec; goto out_bad_rec;
trace_xfs_refcount_get(cur->bc_mp, cur->bc_ag.agno, irec); trace_xfs_refcount_get(cur->bc_mp, cur->bc_ag.pag->pag_agno, irec);
return 0; return 0;
out_bad_rec: out_bad_rec:
...@@ -170,14 +170,14 @@ xfs_refcount_update( ...@@ -170,14 +170,14 @@ xfs_refcount_update(
union xfs_btree_rec rec; union xfs_btree_rec rec;
int error; int error;
trace_xfs_refcount_update(cur->bc_mp, cur->bc_ag.agno, irec); trace_xfs_refcount_update(cur->bc_mp, cur->bc_ag.pag->pag_agno, irec);
rec.refc.rc_startblock = cpu_to_be32(irec->rc_startblock); rec.refc.rc_startblock = cpu_to_be32(irec->rc_startblock);
rec.refc.rc_blockcount = cpu_to_be32(irec->rc_blockcount); rec.refc.rc_blockcount = cpu_to_be32(irec->rc_blockcount);
rec.refc.rc_refcount = cpu_to_be32(irec->rc_refcount); rec.refc.rc_refcount = cpu_to_be32(irec->rc_refcount);
error = xfs_btree_update(cur, &rec); error = xfs_btree_update(cur, &rec);
if (error) if (error)
trace_xfs_refcount_update_error(cur->bc_mp, trace_xfs_refcount_update_error(cur->bc_mp,
cur->bc_ag.agno, error, _RET_IP_); cur->bc_ag.pag->pag_agno, error, _RET_IP_);
return error; return error;
} }
...@@ -194,7 +194,7 @@ xfs_refcount_insert( ...@@ -194,7 +194,7 @@ xfs_refcount_insert(
{ {
int error; int error;
trace_xfs_refcount_insert(cur->bc_mp, cur->bc_ag.agno, irec); trace_xfs_refcount_insert(cur->bc_mp, cur->bc_ag.pag->pag_agno, irec);
cur->bc_rec.rc.rc_startblock = irec->rc_startblock; cur->bc_rec.rc.rc_startblock = irec->rc_startblock;
cur->bc_rec.rc.rc_blockcount = irec->rc_blockcount; cur->bc_rec.rc.rc_blockcount = irec->rc_blockcount;
cur->bc_rec.rc.rc_refcount = irec->rc_refcount; cur->bc_rec.rc.rc_refcount = irec->rc_refcount;
...@@ -209,7 +209,7 @@ xfs_refcount_insert( ...@@ -209,7 +209,7 @@ xfs_refcount_insert(
out_error: out_error:
if (error) if (error)
trace_xfs_refcount_insert_error(cur->bc_mp, trace_xfs_refcount_insert_error(cur->bc_mp,
cur->bc_ag.agno, error, _RET_IP_); cur->bc_ag.pag->pag_agno, error, _RET_IP_);
return error; return error;
} }
...@@ -235,7 +235,7 @@ xfs_refcount_delete( ...@@ -235,7 +235,7 @@ xfs_refcount_delete(
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_error; goto out_error;
} }
trace_xfs_refcount_delete(cur->bc_mp, cur->bc_ag.agno, &irec); trace_xfs_refcount_delete(cur->bc_mp, cur->bc_ag.pag->pag_agno, &irec);
error = xfs_btree_delete(cur, i); error = xfs_btree_delete(cur, i);
if (XFS_IS_CORRUPT(cur->bc_mp, *i != 1)) { if (XFS_IS_CORRUPT(cur->bc_mp, *i != 1)) {
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
...@@ -247,7 +247,7 @@ xfs_refcount_delete( ...@@ -247,7 +247,7 @@ xfs_refcount_delete(
out_error: out_error:
if (error) if (error)
trace_xfs_refcount_delete_error(cur->bc_mp, trace_xfs_refcount_delete_error(cur->bc_mp,
cur->bc_ag.agno, error, _RET_IP_); cur->bc_ag.pag->pag_agno, error, _RET_IP_);
return error; return error;
} }
...@@ -367,7 +367,7 @@ xfs_refcount_split_extent( ...@@ -367,7 +367,7 @@ xfs_refcount_split_extent(
return 0; return 0;
*shape_changed = true; *shape_changed = true;
trace_xfs_refcount_split_extent(cur->bc_mp, cur->bc_ag.agno, trace_xfs_refcount_split_extent(cur->bc_mp, cur->bc_ag.pag->pag_agno,
&rcext, agbno); &rcext, agbno);
/* Establish the right extent. */ /* Establish the right extent. */
...@@ -392,7 +392,7 @@ xfs_refcount_split_extent( ...@@ -392,7 +392,7 @@ xfs_refcount_split_extent(
out_error: out_error:
trace_xfs_refcount_split_extent_error(cur->bc_mp, trace_xfs_refcount_split_extent_error(cur->bc_mp,
cur->bc_ag.agno, error, _RET_IP_); cur->bc_ag.pag->pag_agno, error, _RET_IP_);
return error; return error;
} }
...@@ -412,7 +412,7 @@ xfs_refcount_merge_center_extents( ...@@ -412,7 +412,7 @@ xfs_refcount_merge_center_extents(
int found_rec; int found_rec;
trace_xfs_refcount_merge_center_extents(cur->bc_mp, trace_xfs_refcount_merge_center_extents(cur->bc_mp,
cur->bc_ag.agno, left, center, right); cur->bc_ag.pag->pag_agno, left, center, right);
/* /*
* Make sure the center and right extents are not in the btree. * Make sure the center and right extents are not in the btree.
...@@ -469,7 +469,7 @@ xfs_refcount_merge_center_extents( ...@@ -469,7 +469,7 @@ xfs_refcount_merge_center_extents(
out_error: out_error:
trace_xfs_refcount_merge_center_extents_error(cur->bc_mp, trace_xfs_refcount_merge_center_extents_error(cur->bc_mp,
cur->bc_ag.agno, error, _RET_IP_); cur->bc_ag.pag->pag_agno, error, _RET_IP_);
return error; return error;
} }
...@@ -488,7 +488,7 @@ xfs_refcount_merge_left_extent( ...@@ -488,7 +488,7 @@ xfs_refcount_merge_left_extent(
int found_rec; int found_rec;
trace_xfs_refcount_merge_left_extent(cur->bc_mp, trace_xfs_refcount_merge_left_extent(cur->bc_mp,
cur->bc_ag.agno, left, cleft); cur->bc_ag.pag->pag_agno, left, cleft);
/* If the extent at agbno (cleft) wasn't synthesized, remove it. */ /* If the extent at agbno (cleft) wasn't synthesized, remove it. */
if (cleft->rc_refcount > 1) { if (cleft->rc_refcount > 1) {
...@@ -531,7 +531,7 @@ xfs_refcount_merge_left_extent( ...@@ -531,7 +531,7 @@ xfs_refcount_merge_left_extent(
out_error: out_error:
trace_xfs_refcount_merge_left_extent_error(cur->bc_mp, trace_xfs_refcount_merge_left_extent_error(cur->bc_mp,
cur->bc_ag.agno, error, _RET_IP_); cur->bc_ag.pag->pag_agno, error, _RET_IP_);
return error; return error;
} }
...@@ -549,7 +549,7 @@ xfs_refcount_merge_right_extent( ...@@ -549,7 +549,7 @@ xfs_refcount_merge_right_extent(
int found_rec; int found_rec;
trace_xfs_refcount_merge_right_extent(cur->bc_mp, trace_xfs_refcount_merge_right_extent(cur->bc_mp,
cur->bc_ag.agno, cright, right); cur->bc_ag.pag->pag_agno, cright, right);
/* /*
* If the extent ending at agbno+aglen (cright) wasn't synthesized, * If the extent ending at agbno+aglen (cright) wasn't synthesized,
...@@ -595,7 +595,7 @@ xfs_refcount_merge_right_extent( ...@@ -595,7 +595,7 @@ xfs_refcount_merge_right_extent(
out_error: out_error:
trace_xfs_refcount_merge_right_extent_error(cur->bc_mp, trace_xfs_refcount_merge_right_extent_error(cur->bc_mp,
cur->bc_ag.agno, error, _RET_IP_); cur->bc_ag.pag->pag_agno, error, _RET_IP_);
return error; return error;
} }
...@@ -680,13 +680,13 @@ xfs_refcount_find_left_extents( ...@@ -680,13 +680,13 @@ xfs_refcount_find_left_extents(
cleft->rc_blockcount = aglen; cleft->rc_blockcount = aglen;
cleft->rc_refcount = 1; cleft->rc_refcount = 1;
} }
trace_xfs_refcount_find_left_extent(cur->bc_mp, cur->bc_ag.agno, trace_xfs_refcount_find_left_extent(cur->bc_mp, cur->bc_ag.pag->pag_agno,
left, cleft, agbno); left, cleft, agbno);
return error; return error;
out_error: out_error:
trace_xfs_refcount_find_left_extent_error(cur->bc_mp, trace_xfs_refcount_find_left_extent_error(cur->bc_mp,
cur->bc_ag.agno, error, _RET_IP_); cur->bc_ag.pag->pag_agno, error, _RET_IP_);
return error; return error;
} }
...@@ -769,13 +769,13 @@ xfs_refcount_find_right_extents( ...@@ -769,13 +769,13 @@ xfs_refcount_find_right_extents(
cright->rc_blockcount = aglen; cright->rc_blockcount = aglen;
cright->rc_refcount = 1; cright->rc_refcount = 1;
} }
trace_xfs_refcount_find_right_extent(cur->bc_mp, cur->bc_ag.agno, trace_xfs_refcount_find_right_extent(cur->bc_mp, cur->bc_ag.pag->pag_agno,
cright, right, agbno + aglen); cright, right, agbno + aglen);
return error; return error;
out_error: out_error:
trace_xfs_refcount_find_right_extent_error(cur->bc_mp, trace_xfs_refcount_find_right_extent_error(cur->bc_mp,
cur->bc_ag.agno, error, _RET_IP_); cur->bc_ag.pag->pag_agno, error, _RET_IP_);
return error; return error;
} }
...@@ -953,7 +953,7 @@ xfs_refcount_adjust_extents( ...@@ -953,7 +953,7 @@ xfs_refcount_adjust_extents(
ext.rc_startblock - *agbno); ext.rc_startblock - *agbno);
tmp.rc_refcount = 1 + adj; tmp.rc_refcount = 1 + adj;
trace_xfs_refcount_modify_extent(cur->bc_mp, trace_xfs_refcount_modify_extent(cur->bc_mp,
cur->bc_ag.agno, &tmp); cur->bc_ag.pag->pag_agno, &tmp);
/* /*
* Either cover the hole (increment) or * Either cover the hole (increment) or
...@@ -972,7 +972,7 @@ xfs_refcount_adjust_extents( ...@@ -972,7 +972,7 @@ xfs_refcount_adjust_extents(
cur->bc_ag.refc.nr_ops++; cur->bc_ag.refc.nr_ops++;
} else { } else {
fsbno = XFS_AGB_TO_FSB(cur->bc_mp, fsbno = XFS_AGB_TO_FSB(cur->bc_mp,
cur->bc_ag.agno, cur->bc_ag.pag->pag_agno,
tmp.rc_startblock); tmp.rc_startblock);
xfs_bmap_add_free(cur->bc_tp, fsbno, xfs_bmap_add_free(cur->bc_tp, fsbno,
tmp.rc_blockcount, oinfo); tmp.rc_blockcount, oinfo);
...@@ -999,7 +999,7 @@ xfs_refcount_adjust_extents( ...@@ -999,7 +999,7 @@ xfs_refcount_adjust_extents(
goto skip; goto skip;
ext.rc_refcount += adj; ext.rc_refcount += adj;
trace_xfs_refcount_modify_extent(cur->bc_mp, trace_xfs_refcount_modify_extent(cur->bc_mp,
cur->bc_ag.agno, &ext); cur->bc_ag.pag->pag_agno, &ext);
if (ext.rc_refcount > 1) { if (ext.rc_refcount > 1) {
error = xfs_refcount_update(cur, &ext); error = xfs_refcount_update(cur, &ext);
if (error) if (error)
...@@ -1017,7 +1017,7 @@ xfs_refcount_adjust_extents( ...@@ -1017,7 +1017,7 @@ xfs_refcount_adjust_extents(
goto advloop; goto advloop;
} else { } else {
fsbno = XFS_AGB_TO_FSB(cur->bc_mp, fsbno = XFS_AGB_TO_FSB(cur->bc_mp,
cur->bc_ag.agno, cur->bc_ag.pag->pag_agno,
ext.rc_startblock); ext.rc_startblock);
xfs_bmap_add_free(cur->bc_tp, fsbno, ext.rc_blockcount, xfs_bmap_add_free(cur->bc_tp, fsbno, ext.rc_blockcount,
oinfo); oinfo);
...@@ -1036,7 +1036,7 @@ xfs_refcount_adjust_extents( ...@@ -1036,7 +1036,7 @@ xfs_refcount_adjust_extents(
return error; return error;
out_error: out_error:
trace_xfs_refcount_modify_extent_error(cur->bc_mp, trace_xfs_refcount_modify_extent_error(cur->bc_mp,
cur->bc_ag.agno, error, _RET_IP_); cur->bc_ag.pag->pag_agno, error, _RET_IP_);
return error; return error;
} }
...@@ -1058,10 +1058,10 @@ xfs_refcount_adjust( ...@@ -1058,10 +1058,10 @@ xfs_refcount_adjust(
*new_agbno = agbno; *new_agbno = agbno;
*new_aglen = aglen; *new_aglen = aglen;
if (adj == XFS_REFCOUNT_ADJUST_INCREASE) if (adj == XFS_REFCOUNT_ADJUST_INCREASE)
trace_xfs_refcount_increase(cur->bc_mp, cur->bc_ag.agno, trace_xfs_refcount_increase(cur->bc_mp, cur->bc_ag.pag->pag_agno,
agbno, aglen); agbno, aglen);
else else
trace_xfs_refcount_decrease(cur->bc_mp, cur->bc_ag.agno, trace_xfs_refcount_decrease(cur->bc_mp, cur->bc_ag.pag->pag_agno,
agbno, aglen); agbno, aglen);
/* /*
...@@ -1100,7 +1100,7 @@ xfs_refcount_adjust( ...@@ -1100,7 +1100,7 @@ xfs_refcount_adjust(
return 0; return 0;
out_error: out_error:
trace_xfs_refcount_adjust_error(cur->bc_mp, cur->bc_ag.agno, trace_xfs_refcount_adjust_error(cur->bc_mp, cur->bc_ag.pag->pag_agno,
error, _RET_IP_); error, _RET_IP_);
return error; return error;
} }
...@@ -1297,7 +1297,7 @@ xfs_refcount_find_shared( ...@@ -1297,7 +1297,7 @@ xfs_refcount_find_shared(
int have; int have;
int error; int error;
trace_xfs_refcount_find_shared(cur->bc_mp, cur->bc_ag.agno, trace_xfs_refcount_find_shared(cur->bc_mp, cur->bc_ag.pag->pag_agno,
agbno, aglen); agbno, aglen);
/* By default, skip the whole range */ /* By default, skip the whole range */
...@@ -1377,12 +1377,12 @@ xfs_refcount_find_shared( ...@@ -1377,12 +1377,12 @@ xfs_refcount_find_shared(
done: done:
trace_xfs_refcount_find_shared_result(cur->bc_mp, trace_xfs_refcount_find_shared_result(cur->bc_mp,
cur->bc_ag.agno, *fbno, *flen); cur->bc_ag.pag->pag_agno, *fbno, *flen);
out_error: out_error:
if (error) if (error)
trace_xfs_refcount_find_shared_error(cur->bc_mp, trace_xfs_refcount_find_shared_error(cur->bc_mp,
cur->bc_ag.agno, error, _RET_IP_); cur->bc_ag.pag->pag_agno, error, _RET_IP_);
return error; return error;
} }
...@@ -1479,7 +1479,7 @@ xfs_refcount_adjust_cow_extents( ...@@ -1479,7 +1479,7 @@ xfs_refcount_adjust_cow_extents(
tmp.rc_blockcount = aglen; tmp.rc_blockcount = aglen;
tmp.rc_refcount = 1; tmp.rc_refcount = 1;
trace_xfs_refcount_modify_extent(cur->bc_mp, trace_xfs_refcount_modify_extent(cur->bc_mp,
cur->bc_ag.agno, &tmp); cur->bc_ag.pag->pag_agno, &tmp);
error = xfs_refcount_insert(cur, &tmp, error = xfs_refcount_insert(cur, &tmp,
&found_tmp); &found_tmp);
...@@ -1507,7 +1507,7 @@ xfs_refcount_adjust_cow_extents( ...@@ -1507,7 +1507,7 @@ xfs_refcount_adjust_cow_extents(
ext.rc_refcount = 0; ext.rc_refcount = 0;
trace_xfs_refcount_modify_extent(cur->bc_mp, trace_xfs_refcount_modify_extent(cur->bc_mp,
cur->bc_ag.agno, &ext); cur->bc_ag.pag->pag_agno, &ext);
error = xfs_refcount_delete(cur, &found_rec); error = xfs_refcount_delete(cur, &found_rec);
if (error) if (error)
goto out_error; goto out_error;
...@@ -1523,7 +1523,7 @@ xfs_refcount_adjust_cow_extents( ...@@ -1523,7 +1523,7 @@ xfs_refcount_adjust_cow_extents(
return error; return error;
out_error: out_error:
trace_xfs_refcount_modify_extent_error(cur->bc_mp, trace_xfs_refcount_modify_extent_error(cur->bc_mp,
cur->bc_ag.agno, error, _RET_IP_); cur->bc_ag.pag->pag_agno, error, _RET_IP_);
return error; return error;
} }
...@@ -1569,7 +1569,7 @@ xfs_refcount_adjust_cow( ...@@ -1569,7 +1569,7 @@ xfs_refcount_adjust_cow(
return 0; return 0;
out_error: out_error:
trace_xfs_refcount_adjust_cow_error(cur->bc_mp, cur->bc_ag.agno, trace_xfs_refcount_adjust_cow_error(cur->bc_mp, cur->bc_ag.pag->pag_agno,
error, _RET_IP_); error, _RET_IP_);
return error; return error;
} }
...@@ -1583,7 +1583,7 @@ __xfs_refcount_cow_alloc( ...@@ -1583,7 +1583,7 @@ __xfs_refcount_cow_alloc(
xfs_agblock_t agbno, xfs_agblock_t agbno,
xfs_extlen_t aglen) xfs_extlen_t aglen)
{ {
trace_xfs_refcount_cow_increase(rcur->bc_mp, rcur->bc_ag.agno, trace_xfs_refcount_cow_increase(rcur->bc_mp, rcur->bc_ag.pag->pag_agno,
agbno, aglen); agbno, aglen);
/* Add refcount btree reservation */ /* Add refcount btree reservation */
...@@ -1600,7 +1600,7 @@ __xfs_refcount_cow_free( ...@@ -1600,7 +1600,7 @@ __xfs_refcount_cow_free(
xfs_agblock_t agbno, xfs_agblock_t agbno,
xfs_extlen_t aglen) xfs_extlen_t aglen)
{ {
trace_xfs_refcount_cow_decrease(rcur->bc_mp, rcur->bc_ag.agno, trace_xfs_refcount_cow_decrease(rcur->bc_mp, rcur->bc_ag.pag->pag_agno,
agbno, aglen); agbno, aglen);
/* Remove refcount btree reservation */ /* Remove refcount btree reservation */
......
...@@ -65,7 +65,7 @@ xfs_refcountbt_alloc_block( ...@@ -65,7 +65,7 @@ xfs_refcountbt_alloc_block(
args.tp = cur->bc_tp; args.tp = cur->bc_tp;
args.mp = cur->bc_mp; args.mp = cur->bc_mp;
args.type = XFS_ALLOCTYPE_NEAR_BNO; args.type = XFS_ALLOCTYPE_NEAR_BNO;
args.fsbno = XFS_AGB_TO_FSB(cur->bc_mp, cur->bc_ag.agno, args.fsbno = XFS_AGB_TO_FSB(cur->bc_mp, cur->bc_ag.pag->pag_agno,
xfs_refc_block(args.mp)); xfs_refc_block(args.mp));
args.oinfo = XFS_RMAP_OINFO_REFC; args.oinfo = XFS_RMAP_OINFO_REFC;
args.minlen = args.maxlen = args.prod = 1; args.minlen = args.maxlen = args.prod = 1;
...@@ -74,13 +74,13 @@ xfs_refcountbt_alloc_block( ...@@ -74,13 +74,13 @@ xfs_refcountbt_alloc_block(
error = xfs_alloc_vextent(&args); error = xfs_alloc_vextent(&args);
if (error) if (error)
goto out_error; goto out_error;
trace_xfs_refcountbt_alloc_block(cur->bc_mp, cur->bc_ag.agno, trace_xfs_refcountbt_alloc_block(cur->bc_mp, cur->bc_ag.pag->pag_agno,
args.agbno, 1); args.agbno, 1);
if (args.fsbno == NULLFSBLOCK) { if (args.fsbno == NULLFSBLOCK) {
*stat = 0; *stat = 0;
return 0; return 0;
} }
ASSERT(args.agno == cur->bc_ag.agno); ASSERT(args.agno == cur->bc_ag.pag->pag_agno);
ASSERT(args.len == 1); ASSERT(args.len == 1);
new->s = cpu_to_be32(args.agbno); new->s = cpu_to_be32(args.agbno);
...@@ -105,7 +105,7 @@ xfs_refcountbt_free_block( ...@@ -105,7 +105,7 @@ xfs_refcountbt_free_block(
xfs_fsblock_t fsbno = XFS_DADDR_TO_FSB(mp, XFS_BUF_ADDR(bp)); xfs_fsblock_t fsbno = XFS_DADDR_TO_FSB(mp, XFS_BUF_ADDR(bp));
int error; int error;
trace_xfs_refcountbt_free_block(cur->bc_mp, cur->bc_ag.agno, trace_xfs_refcountbt_free_block(cur->bc_mp, cur->bc_ag.pag->pag_agno,
XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno), 1); XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno), 1);
be32_add_cpu(&agf->agf_refcount_blocks, -1); be32_add_cpu(&agf->agf_refcount_blocks, -1);
xfs_alloc_log_agf(cur->bc_tp, agbp, XFS_AGF_REFCOUNT_BLOCKS); xfs_alloc_log_agf(cur->bc_tp, agbp, XFS_AGF_REFCOUNT_BLOCKS);
...@@ -170,7 +170,7 @@ xfs_refcountbt_init_ptr_from_cur( ...@@ -170,7 +170,7 @@ xfs_refcountbt_init_ptr_from_cur(
{ {
struct xfs_agf *agf = cur->bc_ag.agbp->b_addr; struct xfs_agf *agf = cur->bc_ag.agbp->b_addr;
ASSERT(cur->bc_ag.agno == be32_to_cpu(agf->agf_seqno)); ASSERT(cur->bc_ag.pag->pag_agno == be32_to_cpu(agf->agf_seqno));
ptr->s = agf->agf_refcount_root; ptr->s = agf->agf_refcount_root;
} }
...@@ -334,7 +334,6 @@ xfs_refcountbt_init_common( ...@@ -334,7 +334,6 @@ xfs_refcountbt_init_common(
/* take a reference for the cursor */ /* take a reference for the cursor */
atomic_inc(&pag->pag_ref); atomic_inc(&pag->pag_ref);
cur->bc_ag.pag = pag; cur->bc_ag.pag = pag;
cur->bc_ag.agno = pag->pag_agno;
cur->bc_ag.refc.nr_ops = 0; cur->bc_ag.refc.nr_ops = 0;
cur->bc_ag.refc.shape_changes = 0; cur->bc_ag.refc.shape_changes = 0;
......
...@@ -81,7 +81,7 @@ xfs_rmap_update( ...@@ -81,7 +81,7 @@ xfs_rmap_update(
union xfs_btree_rec rec; union xfs_btree_rec rec;
int error; int error;
trace_xfs_rmap_update(cur->bc_mp, cur->bc_ag.agno, trace_xfs_rmap_update(cur->bc_mp, cur->bc_ag.pag->pag_agno,
irec->rm_startblock, irec->rm_blockcount, irec->rm_startblock, irec->rm_blockcount,
irec->rm_owner, irec->rm_offset, irec->rm_flags); irec->rm_owner, irec->rm_offset, irec->rm_flags);
...@@ -93,7 +93,7 @@ xfs_rmap_update( ...@@ -93,7 +93,7 @@ xfs_rmap_update(
error = xfs_btree_update(cur, &rec); error = xfs_btree_update(cur, &rec);
if (error) if (error)
trace_xfs_rmap_update_error(cur->bc_mp, trace_xfs_rmap_update_error(cur->bc_mp,
cur->bc_ag.agno, error, _RET_IP_); cur->bc_ag.pag->pag_agno, error, _RET_IP_);
return error; return error;
} }
...@@ -109,7 +109,7 @@ xfs_rmap_insert( ...@@ -109,7 +109,7 @@ xfs_rmap_insert(
int i; int i;
int error; int error;
trace_xfs_rmap_insert(rcur->bc_mp, rcur->bc_ag.agno, agbno, trace_xfs_rmap_insert(rcur->bc_mp, rcur->bc_ag.pag->pag_agno, agbno,
len, owner, offset, flags); len, owner, offset, flags);
error = xfs_rmap_lookup_eq(rcur, agbno, len, owner, offset, flags, &i); error = xfs_rmap_lookup_eq(rcur, agbno, len, owner, offset, flags, &i);
...@@ -135,7 +135,7 @@ xfs_rmap_insert( ...@@ -135,7 +135,7 @@ xfs_rmap_insert(
done: done:
if (error) if (error)
trace_xfs_rmap_insert_error(rcur->bc_mp, trace_xfs_rmap_insert_error(rcur->bc_mp,
rcur->bc_ag.agno, error, _RET_IP_); rcur->bc_ag.pag->pag_agno, error, _RET_IP_);
return error; return error;
} }
...@@ -151,7 +151,7 @@ xfs_rmap_delete( ...@@ -151,7 +151,7 @@ xfs_rmap_delete(
int i; int i;
int error; int error;
trace_xfs_rmap_delete(rcur->bc_mp, rcur->bc_ag.agno, agbno, trace_xfs_rmap_delete(rcur->bc_mp, rcur->bc_ag.pag->pag_agno, agbno,
len, owner, offset, flags); len, owner, offset, flags);
error = xfs_rmap_lookup_eq(rcur, agbno, len, owner, offset, flags, &i); error = xfs_rmap_lookup_eq(rcur, agbno, len, owner, offset, flags, &i);
...@@ -172,7 +172,7 @@ xfs_rmap_delete( ...@@ -172,7 +172,7 @@ xfs_rmap_delete(
done: done:
if (error) if (error)
trace_xfs_rmap_delete_error(rcur->bc_mp, trace_xfs_rmap_delete_error(rcur->bc_mp,
rcur->bc_ag.agno, error, _RET_IP_); rcur->bc_ag.pag->pag_agno, error, _RET_IP_);
return error; return error;
} }
...@@ -199,7 +199,7 @@ xfs_rmap_get_rec( ...@@ -199,7 +199,7 @@ xfs_rmap_get_rec(
int *stat) int *stat)
{ {
struct xfs_mount *mp = cur->bc_mp; struct xfs_mount *mp = cur->bc_mp;
xfs_agnumber_t agno = cur->bc_ag.agno; xfs_agnumber_t agno = cur->bc_ag.pag->pag_agno;
union xfs_btree_rec *rec; union xfs_btree_rec *rec;
int error; int error;
...@@ -262,7 +262,7 @@ xfs_rmap_find_left_neighbor_helper( ...@@ -262,7 +262,7 @@ xfs_rmap_find_left_neighbor_helper(
struct xfs_find_left_neighbor_info *info = priv; struct xfs_find_left_neighbor_info *info = priv;
trace_xfs_rmap_find_left_neighbor_candidate(cur->bc_mp, trace_xfs_rmap_find_left_neighbor_candidate(cur->bc_mp,
cur->bc_ag.agno, rec->rm_startblock, cur->bc_ag.pag->pag_agno, rec->rm_startblock,
rec->rm_blockcount, rec->rm_owner, rec->rm_offset, rec->rm_blockcount, rec->rm_owner, rec->rm_offset,
rec->rm_flags); rec->rm_flags);
...@@ -314,7 +314,7 @@ xfs_rmap_find_left_neighbor( ...@@ -314,7 +314,7 @@ xfs_rmap_find_left_neighbor(
info.stat = stat; info.stat = stat;
trace_xfs_rmap_find_left_neighbor_query(cur->bc_mp, trace_xfs_rmap_find_left_neighbor_query(cur->bc_mp,
cur->bc_ag.agno, bno, 0, owner, offset, flags); cur->bc_ag.pag->pag_agno, bno, 0, owner, offset, flags);
error = xfs_rmap_query_range(cur, &info.high, &info.high, error = xfs_rmap_query_range(cur, &info.high, &info.high,
xfs_rmap_find_left_neighbor_helper, &info); xfs_rmap_find_left_neighbor_helper, &info);
...@@ -322,7 +322,7 @@ xfs_rmap_find_left_neighbor( ...@@ -322,7 +322,7 @@ xfs_rmap_find_left_neighbor(
error = 0; error = 0;
if (*stat) if (*stat)
trace_xfs_rmap_find_left_neighbor_result(cur->bc_mp, trace_xfs_rmap_find_left_neighbor_result(cur->bc_mp,
cur->bc_ag.agno, irec->rm_startblock, cur->bc_ag.pag->pag_agno, irec->rm_startblock,
irec->rm_blockcount, irec->rm_owner, irec->rm_blockcount, irec->rm_owner,
irec->rm_offset, irec->rm_flags); irec->rm_offset, irec->rm_flags);
return error; return error;
...@@ -338,7 +338,7 @@ xfs_rmap_lookup_le_range_helper( ...@@ -338,7 +338,7 @@ xfs_rmap_lookup_le_range_helper(
struct xfs_find_left_neighbor_info *info = priv; struct xfs_find_left_neighbor_info *info = priv;
trace_xfs_rmap_lookup_le_range_candidate(cur->bc_mp, trace_xfs_rmap_lookup_le_range_candidate(cur->bc_mp,
cur->bc_ag.agno, rec->rm_startblock, cur->bc_ag.pag->pag_agno, rec->rm_startblock,
rec->rm_blockcount, rec->rm_owner, rec->rm_offset, rec->rm_blockcount, rec->rm_owner, rec->rm_offset,
rec->rm_flags); rec->rm_flags);
...@@ -387,14 +387,14 @@ xfs_rmap_lookup_le_range( ...@@ -387,14 +387,14 @@ xfs_rmap_lookup_le_range(
info.stat = stat; info.stat = stat;
trace_xfs_rmap_lookup_le_range(cur->bc_mp, trace_xfs_rmap_lookup_le_range(cur->bc_mp,
cur->bc_ag.agno, bno, 0, owner, offset, flags); cur->bc_ag.pag->pag_agno, bno, 0, owner, offset, flags);
error = xfs_rmap_query_range(cur, &info.high, &info.high, error = xfs_rmap_query_range(cur, &info.high, &info.high,
xfs_rmap_lookup_le_range_helper, &info); xfs_rmap_lookup_le_range_helper, &info);
if (error == -ECANCELED) if (error == -ECANCELED)
error = 0; error = 0;
if (*stat) if (*stat)
trace_xfs_rmap_lookup_le_range_result(cur->bc_mp, trace_xfs_rmap_lookup_le_range_result(cur->bc_mp,
cur->bc_ag.agno, irec->rm_startblock, cur->bc_ag.pag->pag_agno, irec->rm_startblock,
irec->rm_blockcount, irec->rm_owner, irec->rm_blockcount, irec->rm_owner,
irec->rm_offset, irec->rm_flags); irec->rm_offset, irec->rm_flags);
return error; return error;
...@@ -500,7 +500,7 @@ xfs_rmap_unmap( ...@@ -500,7 +500,7 @@ xfs_rmap_unmap(
(flags & XFS_RMAP_BMBT_BLOCK); (flags & XFS_RMAP_BMBT_BLOCK);
if (unwritten) if (unwritten)
flags |= XFS_RMAP_UNWRITTEN; flags |= XFS_RMAP_UNWRITTEN;
trace_xfs_rmap_unmap(mp, cur->bc_ag.agno, bno, len, trace_xfs_rmap_unmap(mp, cur->bc_ag.pag->pag_agno, bno, len,
unwritten, oinfo); unwritten, oinfo);
/* /*
...@@ -524,7 +524,7 @@ xfs_rmap_unmap( ...@@ -524,7 +524,7 @@ xfs_rmap_unmap(
goto out_error; goto out_error;
} }
trace_xfs_rmap_lookup_le_range_result(cur->bc_mp, trace_xfs_rmap_lookup_le_range_result(cur->bc_mp,
cur->bc_ag.agno, ltrec.rm_startblock, cur->bc_ag.pag->pag_agno, ltrec.rm_startblock,
ltrec.rm_blockcount, ltrec.rm_owner, ltrec.rm_blockcount, ltrec.rm_owner,
ltrec.rm_offset, ltrec.rm_flags); ltrec.rm_offset, ltrec.rm_flags);
ltoff = ltrec.rm_offset; ltoff = ltrec.rm_offset;
...@@ -590,7 +590,7 @@ xfs_rmap_unmap( ...@@ -590,7 +590,7 @@ xfs_rmap_unmap(
if (ltrec.rm_startblock == bno && ltrec.rm_blockcount == len) { if (ltrec.rm_startblock == bno && ltrec.rm_blockcount == len) {
/* exact match, simply remove the record from rmap tree */ /* exact match, simply remove the record from rmap tree */
trace_xfs_rmap_delete(mp, cur->bc_ag.agno, trace_xfs_rmap_delete(mp, cur->bc_ag.pag->pag_agno,
ltrec.rm_startblock, ltrec.rm_blockcount, ltrec.rm_startblock, ltrec.rm_blockcount,
ltrec.rm_owner, ltrec.rm_offset, ltrec.rm_owner, ltrec.rm_offset,
ltrec.rm_flags); ltrec.rm_flags);
...@@ -668,7 +668,7 @@ xfs_rmap_unmap( ...@@ -668,7 +668,7 @@ xfs_rmap_unmap(
else else
cur->bc_rec.r.rm_offset = offset + len; cur->bc_rec.r.rm_offset = offset + len;
cur->bc_rec.r.rm_flags = flags; cur->bc_rec.r.rm_flags = flags;
trace_xfs_rmap_insert(mp, cur->bc_ag.agno, trace_xfs_rmap_insert(mp, cur->bc_ag.pag->pag_agno,
cur->bc_rec.r.rm_startblock, cur->bc_rec.r.rm_startblock,
cur->bc_rec.r.rm_blockcount, cur->bc_rec.r.rm_blockcount,
cur->bc_rec.r.rm_owner, cur->bc_rec.r.rm_owner,
...@@ -680,11 +680,11 @@ xfs_rmap_unmap( ...@@ -680,11 +680,11 @@ xfs_rmap_unmap(
} }
out_done: out_done:
trace_xfs_rmap_unmap_done(mp, cur->bc_ag.agno, bno, len, trace_xfs_rmap_unmap_done(mp, cur->bc_ag.pag->pag_agno, bno, len,
unwritten, oinfo); unwritten, oinfo);
out_error: out_error:
if (error) if (error)
trace_xfs_rmap_unmap_error(mp, cur->bc_ag.agno, trace_xfs_rmap_unmap_error(mp, cur->bc_ag.pag->pag_agno,
error, _RET_IP_); error, _RET_IP_);
return error; return error;
} }
...@@ -775,7 +775,7 @@ xfs_rmap_map( ...@@ -775,7 +775,7 @@ xfs_rmap_map(
(flags & XFS_RMAP_BMBT_BLOCK); (flags & XFS_RMAP_BMBT_BLOCK);
if (unwritten) if (unwritten)
flags |= XFS_RMAP_UNWRITTEN; flags |= XFS_RMAP_UNWRITTEN;
trace_xfs_rmap_map(mp, cur->bc_ag.agno, bno, len, trace_xfs_rmap_map(mp, cur->bc_ag.pag->pag_agno, bno, len,
unwritten, oinfo); unwritten, oinfo);
ASSERT(!xfs_rmap_should_skip_owner_update(oinfo)); ASSERT(!xfs_rmap_should_skip_owner_update(oinfo));
...@@ -797,7 +797,7 @@ xfs_rmap_map( ...@@ -797,7 +797,7 @@ xfs_rmap_map(
goto out_error; goto out_error;
} }
trace_xfs_rmap_lookup_le_range_result(cur->bc_mp, trace_xfs_rmap_lookup_le_range_result(cur->bc_mp,
cur->bc_ag.agno, ltrec.rm_startblock, cur->bc_ag.pag->pag_agno, ltrec.rm_startblock,
ltrec.rm_blockcount, ltrec.rm_owner, ltrec.rm_blockcount, ltrec.rm_owner,
ltrec.rm_offset, ltrec.rm_flags); ltrec.rm_offset, ltrec.rm_flags);
...@@ -833,7 +833,7 @@ xfs_rmap_map( ...@@ -833,7 +833,7 @@ xfs_rmap_map(
goto out_error; goto out_error;
} }
trace_xfs_rmap_find_right_neighbor_result(cur->bc_mp, trace_xfs_rmap_find_right_neighbor_result(cur->bc_mp,
cur->bc_ag.agno, gtrec.rm_startblock, cur->bc_ag.pag->pag_agno, gtrec.rm_startblock,
gtrec.rm_blockcount, gtrec.rm_owner, gtrec.rm_blockcount, gtrec.rm_owner,
gtrec.rm_offset, gtrec.rm_flags); gtrec.rm_offset, gtrec.rm_flags);
if (!xfs_rmap_is_mergeable(&gtrec, owner, flags)) if (!xfs_rmap_is_mergeable(&gtrec, owner, flags))
...@@ -872,7 +872,7 @@ xfs_rmap_map( ...@@ -872,7 +872,7 @@ xfs_rmap_map(
* result: |rrrrrrrrrrrrrrrrrrrrrrrrrrrrr| * result: |rrrrrrrrrrrrrrrrrrrrrrrrrrrrr|
*/ */
ltrec.rm_blockcount += gtrec.rm_blockcount; ltrec.rm_blockcount += gtrec.rm_blockcount;
trace_xfs_rmap_delete(mp, cur->bc_ag.agno, trace_xfs_rmap_delete(mp, cur->bc_ag.pag->pag_agno,
gtrec.rm_startblock, gtrec.rm_startblock,
gtrec.rm_blockcount, gtrec.rm_blockcount,
gtrec.rm_owner, gtrec.rm_owner,
...@@ -923,7 +923,7 @@ xfs_rmap_map( ...@@ -923,7 +923,7 @@ xfs_rmap_map(
cur->bc_rec.r.rm_owner = owner; cur->bc_rec.r.rm_owner = owner;
cur->bc_rec.r.rm_offset = offset; cur->bc_rec.r.rm_offset = offset;
cur->bc_rec.r.rm_flags = flags; cur->bc_rec.r.rm_flags = flags;
trace_xfs_rmap_insert(mp, cur->bc_ag.agno, bno, len, trace_xfs_rmap_insert(mp, cur->bc_ag.pag->pag_agno, bno, len,
owner, offset, flags); owner, offset, flags);
error = xfs_btree_insert(cur, &i); error = xfs_btree_insert(cur, &i);
if (error) if (error)
...@@ -934,11 +934,11 @@ xfs_rmap_map( ...@@ -934,11 +934,11 @@ xfs_rmap_map(
} }
} }
trace_xfs_rmap_map_done(mp, cur->bc_ag.agno, bno, len, trace_xfs_rmap_map_done(mp, cur->bc_ag.pag->pag_agno, bno, len,
unwritten, oinfo); unwritten, oinfo);
out_error: out_error:
if (error) if (error)
trace_xfs_rmap_map_error(mp, cur->bc_ag.agno, trace_xfs_rmap_map_error(mp, cur->bc_ag.pag->pag_agno,
error, _RET_IP_); error, _RET_IP_);
return error; return error;
} }
...@@ -1012,7 +1012,7 @@ xfs_rmap_convert( ...@@ -1012,7 +1012,7 @@ xfs_rmap_convert(
(flags & (XFS_RMAP_ATTR_FORK | XFS_RMAP_BMBT_BLOCK)))); (flags & (XFS_RMAP_ATTR_FORK | XFS_RMAP_BMBT_BLOCK))));
oldext = unwritten ? XFS_RMAP_UNWRITTEN : 0; oldext = unwritten ? XFS_RMAP_UNWRITTEN : 0;
new_endoff = offset + len; new_endoff = offset + len;
trace_xfs_rmap_convert(mp, cur->bc_ag.agno, bno, len, trace_xfs_rmap_convert(mp, cur->bc_ag.pag->pag_agno, bno, len,
unwritten, oinfo); unwritten, oinfo);
/* /*
...@@ -1036,7 +1036,7 @@ xfs_rmap_convert( ...@@ -1036,7 +1036,7 @@ xfs_rmap_convert(
goto done; goto done;
} }
trace_xfs_rmap_lookup_le_range_result(cur->bc_mp, trace_xfs_rmap_lookup_le_range_result(cur->bc_mp,
cur->bc_ag.agno, PREV.rm_startblock, cur->bc_ag.pag->pag_agno, PREV.rm_startblock,
PREV.rm_blockcount, PREV.rm_owner, PREV.rm_blockcount, PREV.rm_owner,
PREV.rm_offset, PREV.rm_flags); PREV.rm_offset, PREV.rm_flags);
...@@ -1078,7 +1078,7 @@ xfs_rmap_convert( ...@@ -1078,7 +1078,7 @@ xfs_rmap_convert(
goto done; goto done;
} }
trace_xfs_rmap_find_left_neighbor_result(cur->bc_mp, trace_xfs_rmap_find_left_neighbor_result(cur->bc_mp,
cur->bc_ag.agno, LEFT.rm_startblock, cur->bc_ag.pag->pag_agno, LEFT.rm_startblock,
LEFT.rm_blockcount, LEFT.rm_owner, LEFT.rm_blockcount, LEFT.rm_owner,
LEFT.rm_offset, LEFT.rm_flags); LEFT.rm_offset, LEFT.rm_flags);
if (LEFT.rm_startblock + LEFT.rm_blockcount == bno && if (LEFT.rm_startblock + LEFT.rm_blockcount == bno &&
...@@ -1116,7 +1116,7 @@ xfs_rmap_convert( ...@@ -1116,7 +1116,7 @@ xfs_rmap_convert(
goto done; goto done;
} }
trace_xfs_rmap_find_right_neighbor_result(cur->bc_mp, trace_xfs_rmap_find_right_neighbor_result(cur->bc_mp,
cur->bc_ag.agno, RIGHT.rm_startblock, cur->bc_ag.pag->pag_agno, RIGHT.rm_startblock,
RIGHT.rm_blockcount, RIGHT.rm_owner, RIGHT.rm_blockcount, RIGHT.rm_owner,
RIGHT.rm_offset, RIGHT.rm_flags); RIGHT.rm_offset, RIGHT.rm_flags);
if (bno + len == RIGHT.rm_startblock && if (bno + len == RIGHT.rm_startblock &&
...@@ -1134,7 +1134,7 @@ xfs_rmap_convert( ...@@ -1134,7 +1134,7 @@ xfs_rmap_convert(
RIGHT.rm_blockcount > XFS_RMAP_LEN_MAX) RIGHT.rm_blockcount > XFS_RMAP_LEN_MAX)
state &= ~RMAP_RIGHT_CONTIG; state &= ~RMAP_RIGHT_CONTIG;
trace_xfs_rmap_convert_state(mp, cur->bc_ag.agno, state, trace_xfs_rmap_convert_state(mp, cur->bc_ag.pag->pag_agno, state,
_RET_IP_); _RET_IP_);
/* reset the cursor back to PREV */ /* reset the cursor back to PREV */
...@@ -1164,7 +1164,7 @@ xfs_rmap_convert( ...@@ -1164,7 +1164,7 @@ xfs_rmap_convert(
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto done; goto done;
} }
trace_xfs_rmap_delete(mp, cur->bc_ag.agno, trace_xfs_rmap_delete(mp, cur->bc_ag.pag->pag_agno,
RIGHT.rm_startblock, RIGHT.rm_blockcount, RIGHT.rm_startblock, RIGHT.rm_blockcount,
RIGHT.rm_owner, RIGHT.rm_offset, RIGHT.rm_owner, RIGHT.rm_offset,
RIGHT.rm_flags); RIGHT.rm_flags);
...@@ -1182,7 +1182,7 @@ xfs_rmap_convert( ...@@ -1182,7 +1182,7 @@ xfs_rmap_convert(
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto done; goto done;
} }
trace_xfs_rmap_delete(mp, cur->bc_ag.agno, trace_xfs_rmap_delete(mp, cur->bc_ag.pag->pag_agno,
PREV.rm_startblock, PREV.rm_blockcount, PREV.rm_startblock, PREV.rm_blockcount,
PREV.rm_owner, PREV.rm_offset, PREV.rm_owner, PREV.rm_offset,
PREV.rm_flags); PREV.rm_flags);
...@@ -1212,7 +1212,7 @@ xfs_rmap_convert( ...@@ -1212,7 +1212,7 @@ xfs_rmap_convert(
* Setting all of a previous oldext extent to newext. * Setting all of a previous oldext extent to newext.
* The left neighbor is contiguous, the right is not. * The left neighbor is contiguous, the right is not.
*/ */
trace_xfs_rmap_delete(mp, cur->bc_ag.agno, trace_xfs_rmap_delete(mp, cur->bc_ag.pag->pag_agno,
PREV.rm_startblock, PREV.rm_blockcount, PREV.rm_startblock, PREV.rm_blockcount,
PREV.rm_owner, PREV.rm_offset, PREV.rm_owner, PREV.rm_offset,
PREV.rm_flags); PREV.rm_flags);
...@@ -1249,7 +1249,7 @@ xfs_rmap_convert( ...@@ -1249,7 +1249,7 @@ xfs_rmap_convert(
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto done; goto done;
} }
trace_xfs_rmap_delete(mp, cur->bc_ag.agno, trace_xfs_rmap_delete(mp, cur->bc_ag.pag->pag_agno,
RIGHT.rm_startblock, RIGHT.rm_blockcount, RIGHT.rm_startblock, RIGHT.rm_blockcount,
RIGHT.rm_owner, RIGHT.rm_offset, RIGHT.rm_owner, RIGHT.rm_offset,
RIGHT.rm_flags); RIGHT.rm_flags);
...@@ -1328,7 +1328,7 @@ xfs_rmap_convert( ...@@ -1328,7 +1328,7 @@ xfs_rmap_convert(
NEW.rm_blockcount = len; NEW.rm_blockcount = len;
NEW.rm_flags = newext; NEW.rm_flags = newext;
cur->bc_rec.r = NEW; cur->bc_rec.r = NEW;
trace_xfs_rmap_insert(mp, cur->bc_ag.agno, bno, trace_xfs_rmap_insert(mp, cur->bc_ag.pag->pag_agno, bno,
len, owner, offset, newext); len, owner, offset, newext);
error = xfs_btree_insert(cur, &i); error = xfs_btree_insert(cur, &i);
if (error) if (error)
...@@ -1385,7 +1385,7 @@ xfs_rmap_convert( ...@@ -1385,7 +1385,7 @@ xfs_rmap_convert(
NEW.rm_blockcount = len; NEW.rm_blockcount = len;
NEW.rm_flags = newext; NEW.rm_flags = newext;
cur->bc_rec.r = NEW; cur->bc_rec.r = NEW;
trace_xfs_rmap_insert(mp, cur->bc_ag.agno, bno, trace_xfs_rmap_insert(mp, cur->bc_ag.pag->pag_agno, bno,
len, owner, offset, newext); len, owner, offset, newext);
error = xfs_btree_insert(cur, &i); error = xfs_btree_insert(cur, &i);
if (error) if (error)
...@@ -1416,7 +1416,7 @@ xfs_rmap_convert( ...@@ -1416,7 +1416,7 @@ xfs_rmap_convert(
NEW = PREV; NEW = PREV;
NEW.rm_blockcount = offset - PREV.rm_offset; NEW.rm_blockcount = offset - PREV.rm_offset;
cur->bc_rec.r = NEW; cur->bc_rec.r = NEW;
trace_xfs_rmap_insert(mp, cur->bc_ag.agno, trace_xfs_rmap_insert(mp, cur->bc_ag.pag->pag_agno,
NEW.rm_startblock, NEW.rm_blockcount, NEW.rm_startblock, NEW.rm_blockcount,
NEW.rm_owner, NEW.rm_offset, NEW.rm_owner, NEW.rm_offset,
NEW.rm_flags); NEW.rm_flags);
...@@ -1443,7 +1443,7 @@ xfs_rmap_convert( ...@@ -1443,7 +1443,7 @@ xfs_rmap_convert(
/* new middle extent - newext */ /* new middle extent - newext */
cur->bc_rec.r.rm_flags &= ~XFS_RMAP_UNWRITTEN; cur->bc_rec.r.rm_flags &= ~XFS_RMAP_UNWRITTEN;
cur->bc_rec.r.rm_flags |= newext; cur->bc_rec.r.rm_flags |= newext;
trace_xfs_rmap_insert(mp, cur->bc_ag.agno, bno, len, trace_xfs_rmap_insert(mp, cur->bc_ag.pag->pag_agno, bno, len,
owner, offset, newext); owner, offset, newext);
error = xfs_btree_insert(cur, &i); error = xfs_btree_insert(cur, &i);
if (error) if (error)
...@@ -1467,12 +1467,12 @@ xfs_rmap_convert( ...@@ -1467,12 +1467,12 @@ xfs_rmap_convert(
ASSERT(0); ASSERT(0);
} }
trace_xfs_rmap_convert_done(mp, cur->bc_ag.agno, bno, len, trace_xfs_rmap_convert_done(mp, cur->bc_ag.pag->pag_agno, bno, len,
unwritten, oinfo); unwritten, oinfo);
done: done:
if (error) if (error)
trace_xfs_rmap_convert_error(cur->bc_mp, trace_xfs_rmap_convert_error(cur->bc_mp,
cur->bc_ag.agno, error, _RET_IP_); cur->bc_ag.pag->pag_agno, error, _RET_IP_);
return error; return error;
} }
...@@ -1508,7 +1508,7 @@ xfs_rmap_convert_shared( ...@@ -1508,7 +1508,7 @@ xfs_rmap_convert_shared(
(flags & (XFS_RMAP_ATTR_FORK | XFS_RMAP_BMBT_BLOCK)))); (flags & (XFS_RMAP_ATTR_FORK | XFS_RMAP_BMBT_BLOCK))));
oldext = unwritten ? XFS_RMAP_UNWRITTEN : 0; oldext = unwritten ? XFS_RMAP_UNWRITTEN : 0;
new_endoff = offset + len; new_endoff = offset + len;
trace_xfs_rmap_convert(mp, cur->bc_ag.agno, bno, len, trace_xfs_rmap_convert(mp, cur->bc_ag.pag->pag_agno, bno, len,
unwritten, oinfo); unwritten, oinfo);
/* /*
...@@ -1575,7 +1575,7 @@ xfs_rmap_convert_shared( ...@@ -1575,7 +1575,7 @@ xfs_rmap_convert_shared(
goto done; goto done;
} }
trace_xfs_rmap_find_right_neighbor_result(cur->bc_mp, trace_xfs_rmap_find_right_neighbor_result(cur->bc_mp,
cur->bc_ag.agno, RIGHT.rm_startblock, cur->bc_ag.pag->pag_agno, RIGHT.rm_startblock,
RIGHT.rm_blockcount, RIGHT.rm_owner, RIGHT.rm_blockcount, RIGHT.rm_owner,
RIGHT.rm_offset, RIGHT.rm_flags); RIGHT.rm_offset, RIGHT.rm_flags);
if (xfs_rmap_is_mergeable(&RIGHT, owner, newext)) if (xfs_rmap_is_mergeable(&RIGHT, owner, newext))
...@@ -1591,7 +1591,7 @@ xfs_rmap_convert_shared( ...@@ -1591,7 +1591,7 @@ xfs_rmap_convert_shared(
RIGHT.rm_blockcount > XFS_RMAP_LEN_MAX) RIGHT.rm_blockcount > XFS_RMAP_LEN_MAX)
state &= ~RMAP_RIGHT_CONTIG; state &= ~RMAP_RIGHT_CONTIG;
trace_xfs_rmap_convert_state(mp, cur->bc_ag.agno, state, trace_xfs_rmap_convert_state(mp, cur->bc_ag.pag->pag_agno, state,
_RET_IP_); _RET_IP_);
/* /*
* Switch out based on the FILLING and CONTIG state bits. * Switch out based on the FILLING and CONTIG state bits.
...@@ -1882,12 +1882,12 @@ xfs_rmap_convert_shared( ...@@ -1882,12 +1882,12 @@ xfs_rmap_convert_shared(
ASSERT(0); ASSERT(0);
} }
trace_xfs_rmap_convert_done(mp, cur->bc_ag.agno, bno, len, trace_xfs_rmap_convert_done(mp, cur->bc_ag.pag->pag_agno, bno, len,
unwritten, oinfo); unwritten, oinfo);
done: done:
if (error) if (error)
trace_xfs_rmap_convert_error(cur->bc_mp, trace_xfs_rmap_convert_error(cur->bc_mp,
cur->bc_ag.agno, error, _RET_IP_); cur->bc_ag.pag->pag_agno, error, _RET_IP_);
return error; return error;
} }
...@@ -1925,7 +1925,7 @@ xfs_rmap_unmap_shared( ...@@ -1925,7 +1925,7 @@ xfs_rmap_unmap_shared(
xfs_owner_info_unpack(oinfo, &owner, &offset, &flags); xfs_owner_info_unpack(oinfo, &owner, &offset, &flags);
if (unwritten) if (unwritten)
flags |= XFS_RMAP_UNWRITTEN; flags |= XFS_RMAP_UNWRITTEN;
trace_xfs_rmap_unmap(mp, cur->bc_ag.agno, bno, len, trace_xfs_rmap_unmap(mp, cur->bc_ag.pag->pag_agno, bno, len,
unwritten, oinfo); unwritten, oinfo);
/* /*
...@@ -2074,12 +2074,12 @@ xfs_rmap_unmap_shared( ...@@ -2074,12 +2074,12 @@ xfs_rmap_unmap_shared(
goto out_error; goto out_error;
} }
trace_xfs_rmap_unmap_done(mp, cur->bc_ag.agno, bno, len, trace_xfs_rmap_unmap_done(mp, cur->bc_ag.pag->pag_agno, bno, len,
unwritten, oinfo); unwritten, oinfo);
out_error: out_error:
if (error) if (error)
trace_xfs_rmap_unmap_error(cur->bc_mp, trace_xfs_rmap_unmap_error(cur->bc_mp,
cur->bc_ag.agno, error, _RET_IP_); cur->bc_ag.pag->pag_agno, error, _RET_IP_);
return error; return error;
} }
...@@ -2114,7 +2114,7 @@ xfs_rmap_map_shared( ...@@ -2114,7 +2114,7 @@ xfs_rmap_map_shared(
xfs_owner_info_unpack(oinfo, &owner, &offset, &flags); xfs_owner_info_unpack(oinfo, &owner, &offset, &flags);
if (unwritten) if (unwritten)
flags |= XFS_RMAP_UNWRITTEN; flags |= XFS_RMAP_UNWRITTEN;
trace_xfs_rmap_map(mp, cur->bc_ag.agno, bno, len, trace_xfs_rmap_map(mp, cur->bc_ag.pag->pag_agno, bno, len,
unwritten, oinfo); unwritten, oinfo);
/* Is there a left record that abuts our range? */ /* Is there a left record that abuts our range? */
...@@ -2140,7 +2140,7 @@ xfs_rmap_map_shared( ...@@ -2140,7 +2140,7 @@ xfs_rmap_map_shared(
goto out_error; goto out_error;
} }
trace_xfs_rmap_find_right_neighbor_result(cur->bc_mp, trace_xfs_rmap_find_right_neighbor_result(cur->bc_mp,
cur->bc_ag.agno, gtrec.rm_startblock, cur->bc_ag.pag->pag_agno, gtrec.rm_startblock,
gtrec.rm_blockcount, gtrec.rm_owner, gtrec.rm_blockcount, gtrec.rm_owner,
gtrec.rm_offset, gtrec.rm_flags); gtrec.rm_offset, gtrec.rm_flags);
...@@ -2233,12 +2233,12 @@ xfs_rmap_map_shared( ...@@ -2233,12 +2233,12 @@ xfs_rmap_map_shared(
goto out_error; goto out_error;
} }
trace_xfs_rmap_map_done(mp, cur->bc_ag.agno, bno, len, trace_xfs_rmap_map_done(mp, cur->bc_ag.pag->pag_agno, bno, len,
unwritten, oinfo); unwritten, oinfo);
out_error: out_error:
if (error) if (error)
trace_xfs_rmap_map_error(cur->bc_mp, trace_xfs_rmap_map_error(cur->bc_mp,
cur->bc_ag.agno, error, _RET_IP_); cur->bc_ag.pag->pag_agno, error, _RET_IP_);
return error; return error;
} }
...@@ -2389,7 +2389,7 @@ xfs_rmap_finish_one( ...@@ -2389,7 +2389,7 @@ xfs_rmap_finish_one(
* the startblock, get one now. * the startblock, get one now.
*/ */
rcur = *pcur; rcur = *pcur;
if (rcur != NULL && rcur->bc_ag.agno != pag->pag_agno) { if (rcur != NULL && rcur->bc_ag.pag != pag) {
xfs_rmap_finish_one_cleanup(tp, rcur, 0); xfs_rmap_finish_one_cleanup(tp, rcur, 0);
rcur = NULL; rcur = NULL;
*pcur = NULL; *pcur = NULL;
......
...@@ -464,7 +464,6 @@ xfs_rmapbt_init_common( ...@@ -464,7 +464,6 @@ xfs_rmapbt_init_common(
/* take a reference for the cursor */ /* take a reference for the cursor */
atomic_inc(&pag->pag_ref); atomic_inc(&pag->pag_ref);
cur->bc_ag.pag = pag; cur->bc_ag.pag = pag;
cur->bc_ag.agno = pag->pag_agno;
return cur; return cur;
} }
......
...@@ -454,7 +454,7 @@ xrep_agfl_walk_rmap( ...@@ -454,7 +454,7 @@ xrep_agfl_walk_rmap(
/* Record all the OWN_AG blocks. */ /* Record all the OWN_AG blocks. */
if (rec->rm_owner == XFS_RMAP_OWN_AG) { if (rec->rm_owner == XFS_RMAP_OWN_AG) {
fsb = XFS_AGB_TO_FSB(cur->bc_mp, cur->bc_ag.agno, fsb = XFS_AGB_TO_FSB(cur->bc_mp, cur->bc_ag.pag->pag_agno,
rec->rm_startblock); rec->rm_startblock);
error = xbitmap_set(ra->freesp, fsb, rec->rm_blockcount); error = xbitmap_set(ra->freesp, fsb, rec->rm_blockcount);
if (error) if (error)
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "scrub/scrub.h" #include "scrub/scrub.h"
#include "scrub/common.h" #include "scrub/common.h"
#include "scrub/btree.h" #include "scrub/btree.h"
#include "xfs_ag.h"
/* /*
* Set us up to scrub free space btrees. * Set us up to scrub free space btrees.
...@@ -93,7 +94,7 @@ xchk_allocbt_rec( ...@@ -93,7 +94,7 @@ xchk_allocbt_rec(
union xfs_btree_rec *rec) union xfs_btree_rec *rec)
{ {
struct xfs_mount *mp = bs->cur->bc_mp; struct xfs_mount *mp = bs->cur->bc_mp;
xfs_agnumber_t agno = bs->cur->bc_ag.agno; xfs_agnumber_t agno = bs->cur->bc_ag.pag->pag_agno;
xfs_agblock_t bno; xfs_agblock_t bno;
xfs_extlen_t len; xfs_extlen_t len;
......
...@@ -515,7 +515,7 @@ xchk_bmap_check_rmap( ...@@ -515,7 +515,7 @@ xchk_bmap_check_rmap(
xchk_fblock_set_corrupt(sc, sbcri->whichfork, xchk_fblock_set_corrupt(sc, sbcri->whichfork,
rec->rm_offset); rec->rm_offset);
if (irec.br_startblock != XFS_AGB_TO_FSB(sc->mp, if (irec.br_startblock != XFS_AGB_TO_FSB(sc->mp,
cur->bc_ag.agno, rec->rm_startblock)) cur->bc_ag.pag->pag_agno, rec->rm_startblock))
xchk_fblock_set_corrupt(sc, sbcri->whichfork, xchk_fblock_set_corrupt(sc, sbcri->whichfork,
rec->rm_offset); rec->rm_offset);
if (irec.br_blockcount > rec->rm_blockcount) if (irec.br_blockcount > rec->rm_blockcount)
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "scrub/common.h" #include "scrub/common.h"
#include "scrub/btree.h" #include "scrub/btree.h"
#include "scrub/trace.h" #include "scrub/trace.h"
#include "xfs_ag.h"
/* /*
* Set us up to scrub inode btrees. * Set us up to scrub inode btrees.
...@@ -103,7 +104,7 @@ xchk_iallocbt_chunk( ...@@ -103,7 +104,7 @@ xchk_iallocbt_chunk(
xfs_extlen_t len) xfs_extlen_t len)
{ {
struct xfs_mount *mp = bs->cur->bc_mp; struct xfs_mount *mp = bs->cur->bc_mp;
xfs_agnumber_t agno = bs->cur->bc_ag.agno; xfs_agnumber_t agno = bs->cur->bc_ag.pag->pag_agno;
xfs_agblock_t bno; xfs_agblock_t bno;
bno = XFS_AGINO_TO_AGBNO(mp, agino); bno = XFS_AGINO_TO_AGBNO(mp, agino);
...@@ -163,7 +164,7 @@ xchk_iallocbt_check_cluster_ifree( ...@@ -163,7 +164,7 @@ xchk_iallocbt_check_cluster_ifree(
* the record, compute which fs inode we're talking about. * the record, compute which fs inode we're talking about.
*/ */
agino = irec->ir_startino + irec_ino; agino = irec->ir_startino + irec_ino;
fsino = XFS_AGINO_TO_INO(mp, bs->cur->bc_ag.agno, agino); fsino = XFS_AGINO_TO_INO(mp, bs->cur->bc_ag.pag->pag_agno, agino);
irec_free = (irec->ir_free & XFS_INOBT_MASK(irec_ino)); irec_free = (irec->ir_free & XFS_INOBT_MASK(irec_ino));
if (be16_to_cpu(dip->di_magic) != XFS_DINODE_MAGIC || if (be16_to_cpu(dip->di_magic) != XFS_DINODE_MAGIC ||
...@@ -213,7 +214,7 @@ xchk_iallocbt_check_cluster( ...@@ -213,7 +214,7 @@ xchk_iallocbt_check_cluster(
struct xfs_mount *mp = bs->cur->bc_mp; struct xfs_mount *mp = bs->cur->bc_mp;
struct xfs_buf *cluster_bp; struct xfs_buf *cluster_bp;
unsigned int nr_inodes; unsigned int nr_inodes;
xfs_agnumber_t agno = bs->cur->bc_ag.agno; xfs_agnumber_t agno = bs->cur->bc_ag.pag->pag_agno;
xfs_agblock_t agbno; xfs_agblock_t agbno;
unsigned int cluster_index; unsigned int cluster_index;
uint16_t cluster_mask = 0; uint16_t cluster_mask = 0;
...@@ -423,7 +424,7 @@ xchk_iallocbt_rec( ...@@ -423,7 +424,7 @@ xchk_iallocbt_rec(
struct xchk_iallocbt *iabt = bs->private; struct xchk_iallocbt *iabt = bs->private;
struct xfs_inobt_rec_incore irec; struct xfs_inobt_rec_incore irec;
uint64_t holes; uint64_t holes;
xfs_agnumber_t agno = bs->cur->bc_ag.agno; xfs_agnumber_t agno = bs->cur->bc_ag.pag->pag_agno;
xfs_agino_t agino; xfs_agino_t agino;
xfs_extlen_t len; xfs_extlen_t len;
int holecount; int holecount;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "scrub/scrub.h" #include "scrub/scrub.h"
#include "scrub/common.h" #include "scrub/common.h"
#include "scrub/btree.h" #include "scrub/btree.h"
#include "xfs_ag.h"
/* /*
* Set us up to scrub reference count btrees. * Set us up to scrub reference count btrees.
...@@ -333,7 +334,7 @@ xchk_refcountbt_rec( ...@@ -333,7 +334,7 @@ xchk_refcountbt_rec(
{ {
struct xfs_mount *mp = bs->cur->bc_mp; struct xfs_mount *mp = bs->cur->bc_mp;
xfs_agblock_t *cow_blocks = bs->private; xfs_agblock_t *cow_blocks = bs->private;
xfs_agnumber_t agno = bs->cur->bc_ag.agno; xfs_agnumber_t agno = bs->cur->bc_ag.pag->pag_agno;
xfs_agblock_t bno; xfs_agblock_t bno;
xfs_extlen_t len; xfs_extlen_t len;
xfs_nlink_t refcount; xfs_nlink_t refcount;
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "scrub/scrub.h" #include "scrub/scrub.h"
#include "scrub/common.h" #include "scrub/common.h"
#include "scrub/btree.h" #include "scrub/btree.h"
#include "xfs_ag.h"
/* /*
* Set us up to scrub reverse mapping btrees. * Set us up to scrub reverse mapping btrees.
...@@ -91,7 +92,7 @@ xchk_rmapbt_rec( ...@@ -91,7 +92,7 @@ xchk_rmapbt_rec(
{ {
struct xfs_mount *mp = bs->cur->bc_mp; struct xfs_mount *mp = bs->cur->bc_mp;
struct xfs_rmap_irec irec; struct xfs_rmap_irec irec;
xfs_agnumber_t agno = bs->cur->bc_ag.agno; xfs_agnumber_t agno = bs->cur->bc_ag.pag->pag_agno;
bool non_inode; bool non_inode;
bool is_unwritten; bool is_unwritten;
bool is_bmbt; bool is_bmbt;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_btree.h" #include "xfs_btree.h"
#include "scrub/scrub.h" #include "scrub/scrub.h"
#include "xfs_ag.h"
/* Figure out which block the btree cursor was pointing to. */ /* Figure out which block the btree cursor was pointing to. */
static inline xfs_fsblock_t static inline xfs_fsblock_t
...@@ -26,7 +27,7 @@ xchk_btree_cur_fsbno( ...@@ -26,7 +27,7 @@ xchk_btree_cur_fsbno(
cur->bc_flags & XFS_BTREE_LONG_PTRS) cur->bc_flags & XFS_BTREE_LONG_PTRS)
return XFS_INO_TO_FSB(cur->bc_mp, cur->bc_ino.ip->i_ino); return XFS_INO_TO_FSB(cur->bc_mp, cur->bc_ino.ip->i_ino);
else if (!(cur->bc_flags & XFS_BTREE_LONG_PTRS)) else if (!(cur->bc_flags & XFS_BTREE_LONG_PTRS))
return XFS_AGB_TO_FSB(cur->bc_mp, cur->bc_ag.agno, 0); return XFS_AGB_TO_FSB(cur->bc_mp, cur->bc_ag.pag->pag_agno, 0);
return NULLFSBLOCK; return NULLFSBLOCK;
} }
......
...@@ -355,7 +355,7 @@ xfs_getfsmap_datadev_helper( ...@@ -355,7 +355,7 @@ xfs_getfsmap_datadev_helper(
xfs_fsblock_t fsb; xfs_fsblock_t fsb;
xfs_daddr_t rec_daddr; xfs_daddr_t rec_daddr;
fsb = XFS_AGB_TO_FSB(mp, cur->bc_ag.agno, rec->rm_startblock); fsb = XFS_AGB_TO_FSB(mp, cur->bc_ag.pag->pag_agno, rec->rm_startblock);
rec_daddr = XFS_FSB_TO_DADDR(mp, fsb); rec_daddr = XFS_FSB_TO_DADDR(mp, fsb);
return xfs_getfsmap_helper(cur->bc_tp, info, rec, rec_daddr); return xfs_getfsmap_helper(cur->bc_tp, info, rec, rec_daddr);
...@@ -373,7 +373,7 @@ xfs_getfsmap_datadev_bnobt_helper( ...@@ -373,7 +373,7 @@ xfs_getfsmap_datadev_bnobt_helper(
struct xfs_rmap_irec irec; struct xfs_rmap_irec irec;
xfs_daddr_t rec_daddr; xfs_daddr_t rec_daddr;
rec_daddr = XFS_AGB_TO_DADDR(mp, cur->bc_ag.agno, rec_daddr = XFS_AGB_TO_DADDR(mp, cur->bc_ag.pag->pag_agno,
rec->ar_startblock); rec->ar_startblock);
irec.rm_startblock = rec->ar_startblock; irec.rm_startblock = rec->ar_startblock;
......
...@@ -3730,7 +3730,7 @@ TRACE_EVENT(xfs_btree_commit_afakeroot, ...@@ -3730,7 +3730,7 @@ TRACE_EVENT(xfs_btree_commit_afakeroot,
TP_fast_assign( TP_fast_assign(
__entry->dev = cur->bc_mp->m_super->s_dev; __entry->dev = cur->bc_mp->m_super->s_dev;
__entry->btnum = cur->bc_btnum; __entry->btnum = cur->bc_btnum;
__entry->agno = cur->bc_ag.agno; __entry->agno = cur->bc_ag.pag->pag_agno;
__entry->agbno = cur->bc_ag.afake->af_root; __entry->agbno = cur->bc_ag.afake->af_root;
__entry->levels = cur->bc_ag.afake->af_levels; __entry->levels = cur->bc_ag.afake->af_levels;
__entry->blocks = cur->bc_ag.afake->af_blocks; __entry->blocks = cur->bc_ag.afake->af_blocks;
...@@ -3845,7 +3845,7 @@ TRACE_EVENT(xfs_btree_bload_block, ...@@ -3845,7 +3845,7 @@ TRACE_EVENT(xfs_btree_bload_block,
__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsb); __entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsb);
__entry->agbno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsb); __entry->agbno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsb);
} else { } else {
__entry->agno = cur->bc_ag.agno; __entry->agno = cur->bc_ag.pag->pag_agno;
__entry->agbno = be32_to_cpu(ptr->s); __entry->agbno = be32_to_cpu(ptr->s);
} }
__entry->nr_records = nr_records; __entry->nr_records = nr_records;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment