diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2018-05-09 10:02:01 -0700 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2018-05-15 17:57:05 -0700 |
commit | 9d9c90286a74decf11caa9dd625f862ae0257ce0 (patch) | |
tree | 7ee3c2221cde32e2446e0a0614654b8d681d3fd8 /fs/xfs/scrub/common.c | |
parent | 08a3a692ef586cc82648b88856a97e0d173319e2 (diff) | |
download | blackbird-op-linux-9d9c90286a74decf11caa9dd625f862ae0257ce0.tar.gz blackbird-op-linux-9d9c90286a74decf11caa9dd625f862ae0257ce0.zip |
xfs: refactor scrub transaction allocation function
Since the transaction allocation helper is about to become more complex,
move it to common.c and remove the redundant parameters.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Diffstat (limited to 'fs/xfs/scrub/common.c')
-rw-r--r-- | fs/xfs/scrub/common.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/fs/xfs/scrub/common.c b/fs/xfs/scrub/common.c index 8ed91d5c868d..95625aa90c24 100644 --- a/fs/xfs/scrub/common.c +++ b/fs/xfs/scrub/common.c @@ -568,13 +568,24 @@ xfs_scrub_ag_init( /* Per-scrubber setup functions */ +/* + * Grab an empty transaction so that we can re-grab locked buffers if + * one of our btrees turns out to be cyclic. + */ +int +xfs_scrub_trans_alloc( + struct xfs_scrub_context *sc) +{ + return xfs_trans_alloc_empty(sc->mp, &sc->tp); +} + /* Set us up with a transaction and an empty context. */ int xfs_scrub_setup_fs( struct xfs_scrub_context *sc, struct xfs_inode *ip) { - return xfs_scrub_trans_alloc(sc->sm, sc->mp, &sc->tp); + return xfs_scrub_trans_alloc(sc); } /* Set us up with AG headers and btree cursors. */ @@ -695,7 +706,6 @@ xfs_scrub_setup_inode_contents( struct xfs_inode *ip, unsigned int resblks) { - struct xfs_mount *mp = sc->mp; int error; error = xfs_scrub_get_inode(sc, ip); @@ -705,7 +715,7 @@ xfs_scrub_setup_inode_contents( /* Got the inode, lock it and we're ready to go. */ sc->ilock_flags = XFS_IOLOCK_EXCL | XFS_MMAPLOCK_EXCL; xfs_ilock(sc->ip, sc->ilock_flags); - error = xfs_scrub_trans_alloc(sc->sm, mp, &sc->tp); + error = xfs_scrub_trans_alloc(sc); if (error) goto out; sc->ilock_flags |= XFS_ILOCK_EXCL; |