summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-02-22 12:40:59 -0800
committerDarrick J. Wong <djwong@kernel.org>2024-02-22 12:40:59 -0800
commit79e72304dcba471e5c0dea2f3c67fe1a0558c140 (patch)
tree48e36fa13e75c90aaa5027d9332bd88d8f217e18 /fs/xfs/libxfs
parent5ef819c34f954fccfc42f79b9b0bea9b40cef9a1 (diff)
xfs: factor out a __xfs_btree_check_lblock_hdr helper
This will allow sharing code with the in-memory block checking helper. 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/libxfs')
-rw-r--r--fs/xfs/libxfs/xfs_btree.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
index 96c1c6968988..b228b22893fa 100644
--- a/fs/xfs/libxfs/xfs_btree.c
+++ b/fs/xfs/libxfs/xfs_btree.c
@@ -94,20 +94,14 @@ xfs_btree_check_agblock_siblings(
return NULL;
}
-/*
- * Check a long btree block header. Return the address of the failing check,
- * or NULL if everything is ok.
- */
static xfs_failaddr_t
-__xfs_btree_check_fsblock(
+__xfs_btree_check_lblock_hdr(
struct xfs_btree_cur *cur,
struct xfs_btree_block *block,
int level,
struct xfs_buf *bp)
{
struct xfs_mount *mp = cur->bc_mp;
- xfs_failaddr_t fa;
- xfs_fsblock_t fsb;
if (xfs_has_crc(mp)) {
if (!uuid_equal(&block->bb_u.l.bb_uuid, &mp->m_sb.sb_meta_uuid))
@@ -127,6 +121,28 @@ __xfs_btree_check_fsblock(
cur->bc_ops->get_maxrecs(cur, level))
return __this_address;
+ return NULL;
+}
+
+/*
+ * Check a long btree block header. Return the address of the failing check,
+ * or NULL if everything is ok.
+ */
+static xfs_failaddr_t
+__xfs_btree_check_fsblock(
+ struct xfs_btree_cur *cur,
+ struct xfs_btree_block *block,
+ int level,
+ struct xfs_buf *bp)
+{
+ struct xfs_mount *mp = cur->bc_mp;
+ xfs_failaddr_t fa;
+ xfs_fsblock_t fsb;
+
+ fa = __xfs_btree_check_lblock_hdr(cur, block, level, bp);
+ if (fa)
+ return fa;
+
/*
* For inode-rooted btrees, the root block sits in the inode fork. In
* that case bp is NULL, and the block must not have any siblings.