Commit f9ef45ad authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

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: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent c6e658ee
...@@ -981,10 +981,22 @@ int bch2_trans_update(struct btree_trans *trans, struct btree_iter *iter, ...@@ -981,10 +981,22 @@ int bch2_trans_update(struct btree_trans *trans, struct btree_iter *iter,
.trigger_flags = flags, .iter = iter, .k = k .trigger_flags = flags, .iter = iter, .k = k
}; };
EBUG_ON(bkey_cmp(iter->pos, #ifdef CONFIG_BCACHEFS_DEBUG
(iter->flags & BTREE_ITER_IS_EXTENTS) BUG_ON(bkey_cmp(iter->pos,
? bkey_start_pos(&k->k) (iter->flags & BTREE_ITER_IS_EXTENTS)
: k->k.p)); ? 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; iter->flags |= BTREE_ITER_KEEP_UNTIL_COMMIT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment