diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2020-02-18 16:17:55 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:36 -0400 |
commit | 2dac0eae78f4e3419320cafb3bd0de2a6a4b5dba (patch) | |
tree | 9e0c94a6c52c5a0827602879f2be2547b95f6b22 /fs/bcachefs/bset.c | |
parent | 3186c80fe93fd2bae4af68b94bb63403e1180ceb (diff) | |
download | linux-2dac0eae78f4e3419320cafb3bd0de2a6a4b5dba.tar.gz linux-2dac0eae78f4e3419320cafb3bd0de2a6a4b5dba.tar.bz2 linux-2dac0eae78f4e3419320cafb3bd0de2a6a4b5dba.zip |
bcachefs: Iterator debug code improvements
More aggressively checking iterator invariants, and fixing the resulting
bugs. Also greatly simplifying iter_next() and iter_next_slot() - they
were hyper optimized before, but the optimizations were getting too
brittle.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/bset.c')
-rw-r--r-- | fs/bcachefs/bset.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/bcachefs/bset.c b/fs/bcachefs/bset.c index fca713fe50fc..09711352094c 100644 --- a/fs/bcachefs/bset.c +++ b/fs/bcachefs/bset.c @@ -1665,7 +1665,8 @@ struct bkey_packed *bch2_btree_node_iter_prev_all(struct btree_node_iter *iter, struct bset_tree *t; unsigned end = 0; - bch2_btree_node_iter_verify(iter, b); + if (btree_keys_expensive_checks(b)) + bch2_btree_node_iter_verify(iter, b); for_each_bset(b, t) { k = bch2_bkey_prev_all(b, t, @@ -1700,7 +1701,8 @@ found: iter->data[0].k = __btree_node_key_to_offset(b, prev); iter->data[0].end = end; - bch2_btree_node_iter_verify(iter, b); + if (btree_keys_expensive_checks(b)) + bch2_btree_node_iter_verify(iter, b); return prev; } |