xfs: create a xchk_trans_alloc_empty helper for scrub

Create a helper to initialize empty transactions on behalf of a scrub
operation.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
Darrick J. Wong 2024-02-22 12:30:52 -08:00
parent 3d8f142697
commit 564fee6d20
3 changed files with 10 additions and 2 deletions

View File

@ -653,6 +653,13 @@ xchk_trans_cancel(
sc->tp = NULL; sc->tp = NULL;
} }
int
xchk_trans_alloc_empty(
struct xfs_scrub *sc)
{
return xfs_trans_alloc_empty(sc->mp, &sc->tp);
}
/* /*
* Grab an empty transaction so that we can re-grab locked buffers if * Grab an empty transaction so that we can re-grab locked buffers if
* one of our btrees turns out to be cyclic. * one of our btrees turns out to be cyclic.
@ -672,7 +679,7 @@ xchk_trans_alloc(
return xfs_trans_alloc(sc->mp, &M_RES(sc->mp)->tr_itruncate, return xfs_trans_alloc(sc->mp, &M_RES(sc->mp)->tr_itruncate,
resblks, 0, 0, &sc->tp); resblks, 0, 0, &sc->tp);
return xfs_trans_alloc_empty(sc->mp, &sc->tp); return xchk_trans_alloc_empty(sc);
} }
/* Set us up with a transaction and an empty context. */ /* Set us up with a transaction and an empty context. */

View File

@ -32,6 +32,7 @@ xchk_should_terminate(
} }
int xchk_trans_alloc(struct xfs_scrub *sc, uint resblks); int xchk_trans_alloc(struct xfs_scrub *sc, uint resblks);
int xchk_trans_alloc_empty(struct xfs_scrub *sc);
void xchk_trans_cancel(struct xfs_scrub *sc); void xchk_trans_cancel(struct xfs_scrub *sc);
bool xchk_process_error(struct xfs_scrub *sc, xfs_agnumber_t agno, bool xchk_process_error(struct xfs_scrub *sc, xfs_agnumber_t agno,

View File

@ -242,7 +242,7 @@ xchk_setup_fscounters(
return error; return error;
} }
return xfs_trans_alloc_empty(sc->mp, &sc->tp); return xchk_trans_alloc_empty(sc);
} }
/* /*