xfs: create helpers to scan an allocation group

Add some helpers to enable us to lock an AG's headers, create btree
cursors for all btrees in that allocation group, and clean up
afterwards.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
This commit is contained in:
Darrick J. Wong
2017-10-17 21:37:38 -07:00
parent 37f3fa7f16
commit b6c1beb967
4 changed files with 214 additions and 0 deletions

View File

@@ -44,6 +44,8 @@
#include "scrub/scrub.h"
#include "scrub/common.h"
#include "scrub/trace.h"
#include "scrub/scrub.h"
#include "scrub/btree.h"
/*
* Online Scrub and Repair
@@ -141,6 +143,7 @@ xfs_scrub_teardown(
struct xfs_scrub_context *sc,
int error)
{
xfs_scrub_ag_free(sc, &sc->sa);
if (sc->tp) {
xfs_trans_cancel(sc->tp);
sc->tp = NULL;
@@ -241,6 +244,7 @@ retry_op:
sc.sm = sm;
sc.ops = ops;
sc.try_harder = try_harder;
sc.sa.agno = NULLAGNUMBER;
error = sc.ops->setup(&sc, ip);
if (error)
goto out_teardown;