提交 54406764 编写于 作者: D Darrick J. Wong

xfs: remove unnecessary agno variable from struct xchk_ag

Now that we always grab an active reference to a perag structure when
dealing with perag metadata, we can remove this unnecessary variable.
Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
上级 7e1826e0
...@@ -640,7 +640,7 @@ xchk_agfl_block( ...@@ -640,7 +640,7 @@ xchk_agfl_block(
{ {
struct xchk_agfl_info *sai = priv; struct xchk_agfl_info *sai = priv;
struct xfs_scrub *sc = sai->sc; struct xfs_scrub *sc = sai->sc;
xfs_agnumber_t agno = sc->sa.agno; xfs_agnumber_t agno = sc->sa.pag->pag_agno;
if (xfs_verify_agbno(mp, agno, agbno) && if (xfs_verify_agbno(mp, agno, agbno) &&
sai->nr_entries < sai->sz_entries) sai->nr_entries < sai->sz_entries)
......
...@@ -94,7 +94,7 @@ xrep_agf_check_agfl_block( ...@@ -94,7 +94,7 @@ xrep_agf_check_agfl_block(
{ {
struct xfs_scrub *sc = priv; struct xfs_scrub *sc = priv;
if (!xfs_verify_agbno(mp, sc->sa.agno, agbno)) if (!xfs_verify_agbno(mp, sc->sa.pag->pag_agno, agbno))
return -EFSCORRUPTED; return -EFSCORRUPTED;
return 0; return 0;
} }
...@@ -188,8 +188,9 @@ xrep_agf_init_header( ...@@ -188,8 +188,9 @@ xrep_agf_init_header(
memset(agf, 0, BBTOB(agf_bp->b_length)); memset(agf, 0, BBTOB(agf_bp->b_length));
agf->agf_magicnum = cpu_to_be32(XFS_AGF_MAGIC); agf->agf_magicnum = cpu_to_be32(XFS_AGF_MAGIC);
agf->agf_versionnum = cpu_to_be32(XFS_AGF_VERSION); agf->agf_versionnum = cpu_to_be32(XFS_AGF_VERSION);
agf->agf_seqno = cpu_to_be32(sc->sa.agno); agf->agf_seqno = cpu_to_be32(sc->sa.pag->pag_agno);
agf->agf_length = cpu_to_be32(xfs_ag_block_count(mp, sc->sa.agno)); agf->agf_length = cpu_to_be32(xfs_ag_block_count(mp,
sc->sa.pag->pag_agno));
agf->agf_flfirst = old_agf->agf_flfirst; agf->agf_flfirst = old_agf->agf_flfirst;
agf->agf_fllast = old_agf->agf_fllast; agf->agf_fllast = old_agf->agf_fllast;
agf->agf_flcount = old_agf->agf_flcount; agf->agf_flcount = old_agf->agf_flcount;
...@@ -371,7 +372,8 @@ xrep_agf( ...@@ -371,7 +372,8 @@ xrep_agf(
* was corrupt after xfs_alloc_read_agf failed with -EFSCORRUPTED. * was corrupt after xfs_alloc_read_agf failed with -EFSCORRUPTED.
*/ */
error = xfs_trans_read_buf(mp, sc->tp, mp->m_ddev_targp, error = xfs_trans_read_buf(mp, sc->tp, mp->m_ddev_targp,
XFS_AG_DADDR(mp, sc->sa.agno, XFS_AGF_DADDR(mp)), XFS_AG_DADDR(mp, sc->sa.pag->pag_agno,
XFS_AGF_DADDR(mp)),
XFS_FSS_TO_BB(mp, 1), 0, &agf_bp, NULL); XFS_FSS_TO_BB(mp, 1), 0, &agf_bp, NULL);
if (error) if (error)
return error; return error;
...@@ -387,7 +389,7 @@ xrep_agf( ...@@ -387,7 +389,7 @@ xrep_agf(
* btrees rooted in the AGF. If the AGFL contents are obviously bad * btrees rooted in the AGF. If the AGFL contents are obviously bad
* then we'll bail out. * then we'll bail out.
*/ */
error = xfs_alloc_read_agfl(mp, sc->tp, sc->sa.agno, &agfl_bp); error = xfs_alloc_read_agfl(mp, sc->tp, sc->sa.pag->pag_agno, &agfl_bp);
if (error) if (error)
return error; return error;
...@@ -585,7 +587,7 @@ xrep_agfl_init_header( ...@@ -585,7 +587,7 @@ xrep_agfl_init_header(
agfl = XFS_BUF_TO_AGFL(agfl_bp); agfl = XFS_BUF_TO_AGFL(agfl_bp);
memset(agfl, 0xFF, BBTOB(agfl_bp->b_length)); memset(agfl, 0xFF, BBTOB(agfl_bp->b_length));
agfl->agfl_magicnum = cpu_to_be32(XFS_AGFL_MAGIC); agfl->agfl_magicnum = cpu_to_be32(XFS_AGFL_MAGIC);
agfl->agfl_seqno = cpu_to_be32(sc->sa.agno); agfl->agfl_seqno = cpu_to_be32(sc->sa.pag->pag_agno);
uuid_copy(&agfl->agfl_uuid, &mp->m_sb.sb_meta_uuid); uuid_copy(&agfl->agfl_uuid, &mp->m_sb.sb_meta_uuid);
/* /*
...@@ -598,7 +600,8 @@ xrep_agfl_init_header( ...@@ -598,7 +600,8 @@ xrep_agfl_init_header(
for_each_xbitmap_extent(br, n, agfl_extents) { for_each_xbitmap_extent(br, n, agfl_extents) {
agbno = XFS_FSB_TO_AGBNO(mp, br->start); agbno = XFS_FSB_TO_AGBNO(mp, br->start);
trace_xrep_agfl_insert(mp, sc->sa.agno, agbno, br->len); trace_xrep_agfl_insert(mp, sc->sa.pag->pag_agno, agbno,
br->len);
while (br->len > 0 && fl_off < flcount) { while (br->len > 0 && fl_off < flcount) {
agfl_bno[fl_off] = cpu_to_be32(agbno); agfl_bno[fl_off] = cpu_to_be32(agbno);
...@@ -647,7 +650,8 @@ xrep_agfl( ...@@ -647,7 +650,8 @@ xrep_agfl(
* nothing wrong with the AGF, but all the AG header repair functions * nothing wrong with the AGF, but all the AG header repair functions
* have this chicken-and-egg problem. * have this chicken-and-egg problem.
*/ */
error = xfs_alloc_read_agf(mp, sc->tp, sc->sa.agno, 0, &agf_bp); error = xfs_alloc_read_agf(mp, sc->tp, sc->sa.pag->pag_agno, 0,
&agf_bp);
if (error) if (error)
return error; return error;
...@@ -656,7 +660,8 @@ xrep_agfl( ...@@ -656,7 +660,8 @@ xrep_agfl(
* was corrupt after xfs_alloc_read_agfl failed with -EFSCORRUPTED. * was corrupt after xfs_alloc_read_agfl failed with -EFSCORRUPTED.
*/ */
error = xfs_trans_read_buf(mp, sc->tp, mp->m_ddev_targp, error = xfs_trans_read_buf(mp, sc->tp, mp->m_ddev_targp,
XFS_AG_DADDR(mp, sc->sa.agno, XFS_AGFL_DADDR(mp)), XFS_AG_DADDR(mp, sc->sa.pag->pag_agno,
XFS_AGFL_DADDR(mp)),
XFS_FSS_TO_BB(mp, 1), 0, &agfl_bp, NULL); XFS_FSS_TO_BB(mp, 1), 0, &agfl_bp, NULL);
if (error) if (error)
return error; return error;
...@@ -721,7 +726,8 @@ xrep_agi_find_btrees( ...@@ -721,7 +726,8 @@ xrep_agi_find_btrees(
int error; int error;
/* Read the AGF. */ /* Read the AGF. */
error = xfs_alloc_read_agf(mp, sc->tp, sc->sa.agno, 0, &agf_bp); error = xfs_alloc_read_agf(mp, sc->tp, sc->sa.pag->pag_agno, 0,
&agf_bp);
if (error) if (error)
return error; return error;
...@@ -759,8 +765,9 @@ xrep_agi_init_header( ...@@ -759,8 +765,9 @@ xrep_agi_init_header(
memset(agi, 0, BBTOB(agi_bp->b_length)); memset(agi, 0, BBTOB(agi_bp->b_length));
agi->agi_magicnum = cpu_to_be32(XFS_AGI_MAGIC); agi->agi_magicnum = cpu_to_be32(XFS_AGI_MAGIC);
agi->agi_versionnum = cpu_to_be32(XFS_AGI_VERSION); agi->agi_versionnum = cpu_to_be32(XFS_AGI_VERSION);
agi->agi_seqno = cpu_to_be32(sc->sa.agno); agi->agi_seqno = cpu_to_be32(sc->sa.pag->pag_agno);
agi->agi_length = cpu_to_be32(xfs_ag_block_count(mp, sc->sa.agno)); agi->agi_length = cpu_to_be32(xfs_ag_block_count(mp,
sc->sa.pag->pag_agno));
agi->agi_newino = cpu_to_be32(NULLAGINO); agi->agi_newino = cpu_to_be32(NULLAGINO);
agi->agi_dirino = cpu_to_be32(NULLAGINO); agi->agi_dirino = cpu_to_be32(NULLAGINO);
if (xfs_sb_version_hascrc(&mp->m_sb)) if (xfs_sb_version_hascrc(&mp->m_sb))
...@@ -899,7 +906,8 @@ xrep_agi( ...@@ -899,7 +906,8 @@ xrep_agi(
* was corrupt after xfs_ialloc_read_agi failed with -EFSCORRUPTED. * was corrupt after xfs_ialloc_read_agi failed with -EFSCORRUPTED.
*/ */
error = xfs_trans_read_buf(mp, sc->tp, mp->m_ddev_targp, error = xfs_trans_read_buf(mp, sc->tp, mp->m_ddev_targp,
XFS_AG_DADDR(mp, sc->sa.agno, XFS_AGI_DADDR(mp)), XFS_AG_DADDR(mp, sc->sa.pag->pag_agno,
XFS_AGI_DADDR(mp)),
XFS_FSS_TO_BB(mp, 1), 0, &agi_bp, NULL); XFS_FSS_TO_BB(mp, 1), 0, &agi_bp, NULL);
if (error) if (error)
return error; return error;
......
...@@ -414,8 +414,6 @@ xchk_ag_read_headers( ...@@ -414,8 +414,6 @@ xchk_ag_read_headers(
if (!sa->pag) if (!sa->pag)
return -ENOENT; return -ENOENT;
sa->agno = agno;
error = xfs_ialloc_read_agi(mp, sc->tp, agno, &sa->agi_bp); error = xfs_ialloc_read_agi(mp, sc->tp, agno, &sa->agi_bp);
if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGI)) if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGI))
return error; return error;
...@@ -531,7 +529,6 @@ xchk_ag_free( ...@@ -531,7 +529,6 @@ xchk_ag_free(
xfs_perag_put(sa->pag); xfs_perag_put(sa->pag);
sa->pag = NULL; sa->pag = NULL;
} }
sa->agno = NULLAGNUMBER;
} }
/* /*
......
...@@ -306,9 +306,9 @@ xrep_alloc_ag_block( ...@@ -306,9 +306,9 @@ xrep_alloc_ag_block(
return -ENOSPC; return -ENOSPC;
xfs_extent_busy_reuse(sc->mp, sc->sa.pag, bno, xfs_extent_busy_reuse(sc->mp, sc->sa.pag, bno,
1, false); 1, false);
*fsbno = XFS_AGB_TO_FSB(sc->mp, sc->sa.agno, bno); *fsbno = XFS_AGB_TO_FSB(sc->mp, sc->sa.pag->pag_agno, bno);
if (resv == XFS_AG_RESV_RMAPBT) if (resv == XFS_AG_RESV_RMAPBT)
xfs_ag_resv_rmapbt_alloc(sc->mp, sc->sa.agno); xfs_ag_resv_rmapbt_alloc(sc->mp, sc->sa.pag->pag_agno);
return 0; return 0;
default: default:
break; break;
...@@ -317,7 +317,7 @@ xrep_alloc_ag_block( ...@@ -317,7 +317,7 @@ xrep_alloc_ag_block(
args.tp = sc->tp; args.tp = sc->tp;
args.mp = sc->mp; args.mp = sc->mp;
args.oinfo = *oinfo; args.oinfo = *oinfo;
args.fsbno = XFS_AGB_TO_FSB(args.mp, sc->sa.agno, 0); args.fsbno = XFS_AGB_TO_FSB(args.mp, sc->sa.pag->pag_agno, 0);
args.minlen = 1; args.minlen = 1;
args.maxlen = 1; args.maxlen = 1;
args.prod = 1; args.prod = 1;
...@@ -352,14 +352,14 @@ xrep_init_btblock( ...@@ -352,14 +352,14 @@ xrep_init_btblock(
trace_xrep_init_btblock(mp, XFS_FSB_TO_AGNO(mp, fsb), trace_xrep_init_btblock(mp, XFS_FSB_TO_AGNO(mp, fsb),
XFS_FSB_TO_AGBNO(mp, fsb), btnum); XFS_FSB_TO_AGBNO(mp, fsb), btnum);
ASSERT(XFS_FSB_TO_AGNO(mp, fsb) == sc->sa.agno); ASSERT(XFS_FSB_TO_AGNO(mp, fsb) == sc->sa.pag->pag_agno);
error = xfs_trans_get_buf(tp, mp->m_ddev_targp, error = xfs_trans_get_buf(tp, mp->m_ddev_targp,
XFS_FSB_TO_DADDR(mp, fsb), XFS_FSB_TO_BB(mp, 1), 0, XFS_FSB_TO_DADDR(mp, fsb), XFS_FSB_TO_BB(mp, 1), 0,
&bp); &bp);
if (error) if (error)
return error; return error;
xfs_buf_zero(bp, 0, BBTOB(bp->b_length)); xfs_buf_zero(bp, 0, BBTOB(bp->b_length));
xfs_btree_init_block(mp, bp, btnum, 0, 0, sc->sa.agno); xfs_btree_init_block(mp, bp, btnum, 0, 0, sc->sa.pag->pag_agno);
xfs_trans_buf_set_type(tp, bp, XFS_BLFT_BTREE_BUF); xfs_trans_buf_set_type(tp, bp, XFS_BLFT_BTREE_BUF);
xfs_trans_log_buf(tp, bp, 0, BBTOB(bp->b_length) - 1); xfs_trans_log_buf(tp, bp, 0, BBTOB(bp->b_length) - 1);
bp->b_ops = ops; bp->b_ops = ops;
...@@ -481,7 +481,7 @@ xrep_fix_freelist( ...@@ -481,7 +481,7 @@ xrep_fix_freelist(
args.mp = sc->mp; args.mp = sc->mp;
args.tp = sc->tp; args.tp = sc->tp;
args.agno = sc->sa.agno; args.agno = sc->sa.pag->pag_agno;
args.alignment = 1; args.alignment = 1;
args.pag = sc->sa.pag; args.pag = sc->sa.pag;
...@@ -615,7 +615,7 @@ xrep_reap_extents( ...@@ -615,7 +615,7 @@ xrep_reap_extents(
for_each_xbitmap_block(fsbno, bmr, n, bitmap) { for_each_xbitmap_block(fsbno, bmr, n, bitmap) {
ASSERT(sc->ip != NULL || ASSERT(sc->ip != NULL ||
XFS_FSB_TO_AGNO(sc->mp, fsbno) == sc->sa.agno); XFS_FSB_TO_AGNO(sc->mp, fsbno) == sc->sa.pag->pag_agno);
trace_xrep_dispose_btree_extent(sc->mp, trace_xrep_dispose_btree_extent(sc->mp,
XFS_FSB_TO_AGNO(sc->mp, fsbno), XFS_FSB_TO_AGNO(sc->mp, fsbno),
XFS_FSB_TO_AGBNO(sc->mp, fsbno), 1); XFS_FSB_TO_AGBNO(sc->mp, fsbno), 1);
...@@ -690,7 +690,7 @@ xrep_findroot_block( ...@@ -690,7 +690,7 @@ xrep_findroot_block(
int block_level; int block_level;
int error = 0; int error = 0;
daddr = XFS_AGB_TO_DADDR(mp, ri->sc->sa.agno, agbno); daddr = XFS_AGB_TO_DADDR(mp, ri->sc->sa.pag->pag_agno, agbno);
/* /*
* Blocks in the AGFL have stale contents that might just happen to * Blocks in the AGFL have stale contents that might just happen to
...@@ -819,7 +819,7 @@ xrep_findroot_block( ...@@ -819,7 +819,7 @@ xrep_findroot_block(
else else
fab->root = NULLAGBLOCK; fab->root = NULLAGBLOCK;
trace_xrep_findroot_block(mp, ri->sc->sa.agno, agbno, trace_xrep_findroot_block(mp, ri->sc->sa.pag->pag_agno, agbno,
be32_to_cpu(btblock->bb_magic), fab->height - 1); be32_to_cpu(btblock->bb_magic), fab->height - 1);
out: out:
xfs_trans_brelse(ri->sc->tp, bp); xfs_trans_brelse(ri->sc->tp, bp);
......
...@@ -464,9 +464,6 @@ xfs_scrub_metadata( ...@@ -464,9 +464,6 @@ xfs_scrub_metadata(
struct xfs_scrub sc = { struct xfs_scrub sc = {
.file = file, .file = file,
.sm = sm, .sm = sm,
.sa = {
.agno = NULLAGNUMBER,
},
}; };
struct xfs_mount *mp = XFS_I(file_inode(file))->i_mount; struct xfs_mount *mp = XFS_I(file_inode(file))->i_mount;
int error = 0; int error = 0;
......
...@@ -35,7 +35,6 @@ struct xchk_meta_ops { ...@@ -35,7 +35,6 @@ struct xchk_meta_ops {
/* Buffer pointers and btree cursors for an entire AG. */ /* Buffer pointers and btree cursors for an entire AG. */
struct xchk_ag { struct xchk_ag {
xfs_agnumber_t agno;
struct xfs_perag *pag; struct xfs_perag *pag;
/* AG btree roots */ /* AG btree roots */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册