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/alloc.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/alloc.c')
-rw-r--r-- | fs/xfs/scrub/alloc.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/xfs/scrub/alloc.c b/fs/xfs/scrub/alloc.c index ab427b4d7fe0..3b38f4e2a537 100644 --- a/fs/xfs/scrub/alloc.c +++ b/fs/xfs/scrub/alloc.c @@ -100,9 +100,7 @@ xchk_allocbt_rec( bno = be32_to_cpu(rec->alloc.ar_startblock); len = be32_to_cpu(rec->alloc.ar_blockcount); - 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); xchk_allocbt_xref(bs->sc, bno, len); |