diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-01-19 01:59:03 +0100 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:08:51 +0200 |
commit | f9ef45ad434ba85363aab6d74fa48499f7ea6499 (patch) | |
tree | ced5c8d20c5af654197cd0ac5cf21c420bb50d76 /fs/bcachefs/btree_update_leaf.c | |
parent | bcachefs: Preserve stripe blockcounts on existing stripes (diff) | |
download | linux-f9ef45ad434ba85363aab6d74fa48499f7ea6499.tar.xz linux-f9ef45ad434ba85363aab6d74fa48499f7ea6499.zip |
bcachefs: Verify transaction updates are sorted
A user reported a bug that implies they might not be correctly sorted,
this should help track that down.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to '')
-rw-r--r-- | fs/bcachefs/btree_update_leaf.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c index a25cc3b7db39..ffd8e0b14257 100644 --- a/fs/bcachefs/btree_update_leaf.c +++ b/fs/bcachefs/btree_update_leaf.c @@ -981,10 +981,22 @@ int bch2_trans_update(struct btree_trans *trans, struct btree_iter *iter, .trigger_flags = flags, .iter = iter, .k = k }; - EBUG_ON(bkey_cmp(iter->pos, - (iter->flags & BTREE_ITER_IS_EXTENTS) - ? bkey_start_pos(&k->k) - : k->k.p)); +#ifdef CONFIG_BCACHEFS_DEBUG + BUG_ON(bkey_cmp(iter->pos, + (iter->flags & BTREE_ITER_IS_EXTENTS) + ? bkey_start_pos(&k->k) + : k->k.p)); + + trans_for_each_update(trans, i) { + BUG_ON(bkey_cmp(i->iter->pos, + (i->iter->flags & BTREE_ITER_IS_EXTENTS) + ? bkey_start_pos(&i->k->k) + : i->k->k.p)); + + BUG_ON(i != trans->updates && + btree_iter_pos_cmp(i[-1].iter, i[0].iter) >= 0); + } +#endif iter->flags |= BTREE_ITER_KEEP_UNTIL_COMMIT; |