mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
xfs: grab the per-ag structure whenever relevant
Grab and hold the per-AG data across a scrub run whenever relevant. This helps us avoid repeated trips through rcu and the radix tree in the repair code. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
This commit is contained in:
parent
05edd888d1
commit
51863d7dd7
3 changed files with 19 additions and 0 deletions
|
@ -541,6 +541,10 @@ xfs_scrub_ag_free(
|
|||
xfs_trans_brelse(sc->tp, sa->agi_bp);
|
||||
sa->agi_bp = NULL;
|
||||
}
|
||||
if (sa->pag) {
|
||||
xfs_perag_put(sa->pag);
|
||||
sa->pag = NULL;
|
||||
}
|
||||
sa->agno = NULLAGNUMBER;
|
||||
}
|
||||
|
||||
|
@ -568,6 +572,19 @@ xfs_scrub_ag_init(
|
|||
return xfs_scrub_ag_btcur_init(sc, sa);
|
||||
}
|
||||
|
||||
/*
|
||||
* Grab the per-ag structure if we haven't already gotten it. Teardown of the
|
||||
* xfs_scrub_ag will release it for us.
|
||||
*/
|
||||
void
|
||||
xfs_scrub_perag_get(
|
||||
struct xfs_mount *mp,
|
||||
struct xfs_scrub_ag *sa)
|
||||
{
|
||||
if (!sa->pag)
|
||||
sa->pag = xfs_perag_get(mp, sa->agno);
|
||||
}
|
||||
|
||||
/* Per-scrubber setup functions */
|
||||
|
||||
/*
|
||||
|
|
|
@ -123,6 +123,7 @@ xfs_scrub_setup_quota(struct xfs_scrub_context *sc, struct xfs_inode *ip)
|
|||
void xfs_scrub_ag_free(struct xfs_scrub_context *sc, struct xfs_scrub_ag *sa);
|
||||
int xfs_scrub_ag_init(struct xfs_scrub_context *sc, xfs_agnumber_t agno,
|
||||
struct xfs_scrub_ag *sa);
|
||||
void xfs_scrub_perag_get(struct xfs_mount *mp, struct xfs_scrub_ag *sa);
|
||||
int xfs_scrub_ag_read_headers(struct xfs_scrub_context *sc, xfs_agnumber_t agno,
|
||||
struct xfs_buf **agi, struct xfs_buf **agf,
|
||||
struct xfs_buf **agfl);
|
||||
|
|
|
@ -51,6 +51,7 @@ struct xfs_scrub_meta_ops {
|
|||
/* Buffer pointers and btree cursors for an entire AG. */
|
||||
struct xfs_scrub_ag {
|
||||
xfs_agnumber_t agno;
|
||||
struct xfs_perag *pag;
|
||||
|
||||
/* AG btree roots */
|
||||
struct xfs_buf *agf_bp;
|
||||
|
|
Loading…
Reference in a new issue