summaryrefslogtreecommitdiffstats
path: root/fs/xfs/scrub/refcount.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2022-10-26 23:31:27 +0200
committerDarrick J. Wong <djwong@kernel.org>2022-10-31 16:58:21 +0100
commitf492135df0aa0417337f9b8b1cc6d6a994d61d25 (patch)
treeabcd902f27b79369f061dc278aa150e3d09b18d2 /fs/xfs/scrub/refcount.c
parentxfs: report refcount domain in tracepoints (diff)
downloadlinux-f492135df0aa0417337f9b8b1cc6d6a994d61d25.tar.xz
linux-f492135df0aa0417337f9b8b1cc6d6a994d61d25.zip
xfs: refactor domain and refcount checking
Create a helper function to ensure that CoW staging extent records have a single refcount and that shared extent records have more than 1 refcount. We'll put this to more use in the next patch. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/scrub/refcount.c')
-rw-r--r--fs/xfs/scrub/refcount.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/xfs/scrub/refcount.c b/fs/xfs/scrub/refcount.c
index af5b796ec9ec..fe5ffe4f478d 100644
--- a/fs/xfs/scrub/refcount.c
+++ b/fs/xfs/scrub/refcount.c
@@ -337,14 +337,12 @@ xchk_refcountbt_rec(
xfs_refcount_btrec_to_irec(rec, &irec);
- /* Only CoW records can have refcount == 1. */
- if (irec.rc_domain == XFS_REFC_DOMAIN_SHARED && irec.rc_refcount == 1)
+ /* Check the domain and refcount are not incompatible. */
+ if (!xfs_refcount_check_domain(&irec))
xchk_btree_set_corrupt(bs->sc, bs->cur, 0);
- if (irec.rc_domain == XFS_REFC_DOMAIN_COW) {
- if (irec.rc_refcount != 1)
- xchk_btree_set_corrupt(bs->sc, bs->cur, 0);
+
+ if (irec.rc_domain == XFS_REFC_DOMAIN_COW)
(*cow_blocks) += irec.rc_blockcount;
- }
/* Check the extent. */
if (!xfs_verify_agbext(pag, irec.rc_startblock, irec.rc_blockcount))