summaryrefslogtreecommitdiff
path: root/fs/xfs/scrub/btree.h
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2022-10-21 14:30:05 -0700
committerDarrick J. Wong <djwong@kernel.org>2022-11-09 19:07:16 -0800
commit423ac23dc1ed6f7c37b7b57a2c43724c51c44dfe (patch)
treeead3e9b2b5bd77b8a77db385835fa2189d621280 /fs/xfs/scrub/btree.h
parent80e5a9ba218ca6cf4b950b858c20e3a8df9d368d (diff)
xfs: always scrub record/key order of interior recordsbtree-key-enhancements_2022-11-09
In commit d47fef9342d0, we removed the firstrec and firstkey fields of struct xchk_btree because Christoph thought they were unnecessary because we could use the record index in the btree cursor. This is incorrect because bc_ptrs (now bc_levels[].ptr) tracks the cursor position within a specific btree block, not within the entire level. The end result is that scrub no longer detects situations where the rightmost record of a block is identical to the leftmost record of that block's right sibling. Fix this regression by reintroducing record validity booleans so that order checking skips *only* the leftmost record/key in each level. Fixes: d47fef9342d0 ("xfs: don't track firstrec/firstkey separately in xchk_btree") Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/scrub/btree.h')
-rw-r--r--fs/xfs/scrub/btree.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/xfs/scrub/btree.h b/fs/xfs/scrub/btree.h
index 26c499925b5e..def8da9c4b4a 100644
--- a/fs/xfs/scrub/btree.h
+++ b/fs/xfs/scrub/btree.h
@@ -31,6 +31,11 @@ typedef int (*xchk_btree_rec_fn)(
struct xchk_btree *bs,
const union xfs_btree_rec *rec);
+struct xchk_btree_key {
+ union xfs_btree_key key;
+ bool valid;
+};
+
struct xchk_btree {
/* caller-provided scrub state */
struct xfs_scrub *sc;
@@ -40,11 +45,12 @@ struct xchk_btree {
void *private;
/* internal scrub state */
+ bool lastrec_valid;
union xfs_btree_rec lastrec;
struct list_head to_check;
/* this element must come last! */
- union xfs_btree_key lastkey[];
+ struct xchk_btree_key lastkey[];
};
/*