summaryrefslogtreecommitdiff
path: root/fs/xfs/scrub/refcount.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2022-10-29 01:48:58 +0300
committerDarrick J. Wong <djwong@kernel.org>2022-10-31 18:58:20 +0300
commitb65e08f83b119ae9345ed23d4da357a72b3cb55c (patch)
tree5c25440a24f3ed77d51f8401412b939e20f6a8fb /fs/xfs/scrub/refcount.c
parentf850995f60e49818093ef5e477cdb0ff2c11a0a4 (diff)
downloadlinux-b65e08f83b119ae9345ed23d4da357a72b3cb55c.tar.xz
xfs: create a predicate to verify per-AG extents
Create a predicate function to verify that a given agbno/blockcount pair fit entirely within a single allocation group and don't suffer mathematical overflows. Refactor the existng open-coded logic; we're going to add more calls to this function 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.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/xfs/scrub/refcount.c b/fs/xfs/scrub/refcount.c
index c68b767dc08f..9959397f797f 100644
--- a/fs/xfs/scrub/refcount.c
+++ b/fs/xfs/scrub/refcount.c
@@ -354,9 +354,8 @@ xchk_refcountbt_rec(
/* Check the extent. */
bno &= ~XFS_REFC_COW_START;
- if (bno + len <= bno ||
- !xfs_verify_agbno(pag, bno) ||
- !xfs_verify_agbno(pag, bno + len - 1))
+
+ if (!xfs_verify_agbext(pag, bno, len))
xchk_btree_set_corrupt(bs->sc, bs->cur, 0);
if (refcount == 0)