diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-10-29 01:48:58 +0300 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2022-10-31 18:58:20 +0300 |
commit | b65e08f83b119ae9345ed23d4da357a72b3cb55c (patch) | |
tree | 5c25440a24f3ed77d51f8401412b939e20f6a8fb /fs/xfs/scrub/refcount.c | |
parent | f850995f60e49818093ef5e477cdb0ff2c11a0a4 (diff) | |
download | linux-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.c | 5 |
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) |