summaryrefslogtreecommitdiffstats
path: root/fs/xfs/scrub/common.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-05-29 22:24:44 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2018-05-30 08:03:14 -0700
commit51863d7dd77dd27a35b12b37c7caf8679903b6ae (patch)
tree462c165bfb2c16e70390f79688244cfa2a1d2abe /fs/xfs/scrub/common.c
parent05edd888d1b21b7c6af10fa3e0cdc1e5b4578493 (diff)
downloadblackbird-op-linux-51863d7dd77dd27a35b12b37c7caf8679903b6ae.tar.gz
blackbird-op-linux-51863d7dd77dd27a35b12b37c7caf8679903b6ae.zip
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>
Diffstat (limited to 'fs/xfs/scrub/common.c')
-rw-r--r--fs/xfs/scrub/common.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/xfs/scrub/common.c b/fs/xfs/scrub/common.c
index 518bff2be0c9..d3e5adc96411 100644
--- a/fs/xfs/scrub/common.c
+++ b/fs/xfs/scrub/common.c
@@ -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 */
/*
OpenPOWER on IntegriCloud