xfs: create a xchk_trans_alloc_empty helper for scrub
authorDarrick J. Wong <djwong@kernel.org>
Thu, 22 Feb 2024 20:30:52 +0000 (12:30 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 22 Feb 2024 20:30:52 +0000 (12:30 -0800)
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>
fs/xfs/scrub/common.c
fs/xfs/scrub/common.h
fs/xfs/scrub/fscounters.c

index 81f2b96bb5a74256e4bdfb9ff9e7fb951a30633a..47557f2a799508fc2ec56b6e23a8674d907058f3 100644 (file)
@@ -653,6 +653,13 @@ xchk_trans_cancel(
        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
  * 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,
                                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. */
index da09580b454a010e8dc6dc4c268e347580aae552..d2ca423b02c7a2fa87511c8ca368185ee0297639 100644 (file)
@@ -32,6 +32,7 @@ xchk_should_terminate(
 }
 
 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);
 
 bool xchk_process_error(struct xfs_scrub *sc, xfs_agnumber_t agno,
index 5799e9a94f1f665dba31af5b5908248311aa1fb1..893c5a6e3ddb038e7509abca69055da293007fa9 100644 (file)
@@ -242,7 +242,7 @@ xchk_setup_fscounters(
                        return error;
        }
 
-       return xfs_trans_alloc_empty(sc->mp, &sc->tp);
+       return xchk_trans_alloc_empty(sc);
 }
 
 /*