diff options
Diffstat (limited to 'fs/xfs/scrub/repair.c')
-rw-r--r-- | fs/xfs/scrub/repair.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/fs/xfs/scrub/repair.c b/fs/xfs/scrub/repair.c index 20667b8b2754..badd716eea75 100644 --- a/fs/xfs/scrub/repair.c +++ b/fs/xfs/scrub/repair.c @@ -1564,6 +1564,39 @@ xrep_ag_btcur_init( sa->agf_bp, sc->sa.pag); } +/* Given a reference to a perag structure, load AG headers and cursors. */ +int +xrep_ag_init( + struct xfs_scrub *sc, + struct xfs_perag *pag, + struct xchk_ag *sa) +{ + int error; + + ASSERT(!sa->pag); + + error = xfs_ialloc_read_agi(sc->mp, sc->tp, pag->pag_agno, + &sa->agi_bp); + if (error) + return error; + + error = xfs_alloc_read_agf(sc->mp, sc->tp, pag->pag_agno, 0, + &sa->agf_bp); + if (error) + return error; + + error = xfs_alloc_read_agfl(sc->mp, sc->tp, pag->pag_agno, + &sa->agfl_bp); + if (error) + return error; + + /* Grab our own reference to the perag structure. */ + atomic_inc(&pag->pag_ref); + sa->pag = pag; + xrep_ag_btcur_init(sc, sa); + return 0; +} + /* Reinitialize the per-AG block reservation for the AG we just fixed. */ int xrep_reset_perag_resv( |