diff options
author | Christoph Hellwig <hch@lst.de> | 2024-02-22 12:40:54 -0800 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2024-02-22 12:40:54 -0800 |
commit | 57982d6c835a71da5c66e6090680de1adf6e736a (patch) | |
tree | 157c8a269cc3e8b84b3089690922c32e7c25cb3e /fs/xfs/scrub | |
parent | fb0793f206701a68f8588a09bf32f7cf44878ea3 (diff) | |
download | linux-57982d6c835a71da5c66e6090680de1adf6e736a.tar.gz linux-57982d6c835a71da5c66e6090680de1adf6e736a.tar.bz2 linux-57982d6c835a71da5c66e6090680de1adf6e736a.zip |
xfs: consolidate btree ptr checking
Merge xfs_btree_check_sptr and xfs_btree_check_lptr into a single
__xfs_btree_check_ptr that can be shared between xfs_btree_check_ptr
and the scrub code.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/scrub')
-rw-r--r-- | fs/xfs/scrub/btree.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/fs/xfs/scrub/btree.c b/fs/xfs/scrub/btree.c index 187d692a0b58..6fe5dae06f23 100644 --- a/fs/xfs/scrub/btree.c +++ b/fs/xfs/scrub/btree.c @@ -236,22 +236,18 @@ xchk_btree_ptr_ok( int level, union xfs_btree_ptr *ptr) { - bool res; - /* A btree rooted in an inode has no block pointer to the root. */ if (bs->cur->bc_ops->type == XFS_BTREE_TYPE_INODE && level == bs->cur->bc_nlevels) return true; /* Otherwise, check the pointers. */ - if (bs->cur->bc_ops->ptr_len == XFS_BTREE_LONG_PTR_LEN) - res = xfs_btree_check_lptr(bs->cur, be64_to_cpu(ptr->l), level); - else - res = xfs_btree_check_sptr(bs->cur, be32_to_cpu(ptr->s), level); - if (!res) + if (__xfs_btree_check_ptr(bs->cur, ptr, 0, level)) { xchk_btree_set_corrupt(bs->sc, bs->cur, level); + return false; + } - return res; + return true; } /* Check that a btree block's sibling matches what we expect it. */ |