Skip to content

Commit 169c030

Browse files
author
Chandan Babu R
committed
Merge tag 'btree-check-cleanups-6.9_2024-02-23' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux into xfs-6.9-mergeC
xfs: btree check cleanups Minor cleanups for the btree block pointer checking code. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org> * tag 'btree-check-cleanups-6.9_2024-02-23' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux: xfs: factor out a __xfs_btree_check_lblock_hdr helper xfs: rename btree helpers that depends on the block number representation xfs: consolidate btree block verification xfs: tighten up validation of root block in inode forks xfs: remove the crc variable in __xfs_btree_check_lblock xfs: misc cleanups for __xfs_btree_check_sblock xfs: consolidate btree ptr checking xfs: open code xfs_btree_check_lptr in xfs_bmap_btree_to_extents xfs: simplify xfs_btree_check_lblock_siblings xfs: simplify xfs_btree_check_sblock_siblings
2 parents ee13821 + 79e7230 commit 169c030

9 files changed

Lines changed: 159 additions & 200 deletions

File tree

fs/xfs/libxfs/xfs_alloc_btree.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ xfs_allocbt_verify(
322322
return __this_address;
323323

324324
if (xfs_has_crc(mp)) {
325-
fa = xfs_btree_sblock_v5hdr_verify(bp);
325+
fa = xfs_btree_agblock_v5hdr_verify(bp);
326326
if (fa)
327327
return fa;
328328
}
@@ -362,7 +362,7 @@ xfs_allocbt_verify(
362362
} else if (level >= mp->m_alloc_maxlevels)
363363
return __this_address;
364364

365-
return xfs_btree_sblock_verify(bp, mp->m_alloc_mxr[level != 0]);
365+
return xfs_btree_agblock_verify(bp, mp->m_alloc_mxr[level != 0]);
366366
}
367367

368368
static void
@@ -371,7 +371,7 @@ xfs_allocbt_read_verify(
371371
{
372372
xfs_failaddr_t fa;
373373

374-
if (!xfs_btree_sblock_verify_crc(bp))
374+
if (!xfs_btree_agblock_verify_crc(bp))
375375
xfs_verifier_error(bp, -EFSBADCRC, __this_address);
376376
else {
377377
fa = xfs_allocbt_verify(bp);
@@ -395,7 +395,7 @@ xfs_allocbt_write_verify(
395395
xfs_verifier_error(bp, -EFSCORRUPTED, fa);
396396
return;
397397
}
398-
xfs_btree_sblock_calc_crc(bp);
398+
xfs_btree_agblock_calc_crc(bp);
399399

400400
}
401401

fs/xfs/libxfs/xfs_bmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ xfs_bmap_btree_to_extents(
568568
pp = XFS_BMAP_BROOT_PTR_ADDR(mp, rblock, 1, ifp->if_broot_bytes);
569569
cbno = be64_to_cpu(*pp);
570570
#ifdef DEBUG
571-
if (XFS_IS_CORRUPT(cur->bc_mp, !xfs_btree_check_lptr(cur, cbno, 1))) {
571+
if (XFS_IS_CORRUPT(cur->bc_mp, !xfs_verify_fsbno(mp, cbno))) {
572572
xfs_btree_mark_sick(cur);
573573
return -EFSCORRUPTED;
574574
}

fs/xfs/libxfs/xfs_bmap_btree.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ xfs_bmbt_verify(
420420
* XXX: need a better way of verifying the owner here. Right now
421421
* just make sure there has been one set.
422422
*/
423-
fa = xfs_btree_lblock_v5hdr_verify(bp, XFS_RMAP_OWN_UNKNOWN);
423+
fa = xfs_btree_fsblock_v5hdr_verify(bp, XFS_RMAP_OWN_UNKNOWN);
424424
if (fa)
425425
return fa;
426426
}
@@ -436,7 +436,7 @@ xfs_bmbt_verify(
436436
if (level > max(mp->m_bm_maxlevels[0], mp->m_bm_maxlevels[1]))
437437
return __this_address;
438438

439-
return xfs_btree_lblock_verify(bp, mp->m_bmap_dmxr[level != 0]);
439+
return xfs_btree_fsblock_verify(bp, mp->m_bmap_dmxr[level != 0]);
440440
}
441441

442442
static void
@@ -445,7 +445,7 @@ xfs_bmbt_read_verify(
445445
{
446446
xfs_failaddr_t fa;
447447

448-
if (!xfs_btree_lblock_verify_crc(bp))
448+
if (!xfs_btree_fsblock_verify_crc(bp))
449449
xfs_verifier_error(bp, -EFSBADCRC, __this_address);
450450
else {
451451
fa = xfs_bmbt_verify(bp);
@@ -469,7 +469,7 @@ xfs_bmbt_write_verify(
469469
xfs_verifier_error(bp, -EFSCORRUPTED, fa);
470470
return;
471471
}
472-
xfs_btree_lblock_calc_crc(bp);
472+
xfs_btree_fsblock_calc_crc(bp);
473473
}
474474

475475
const struct xfs_buf_ops xfs_bmbt_buf_ops = {

0 commit comments

Comments
 (0)