mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 19:00:25 +00:00
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>
This commit is contained in:
parent
c6e658ee9f
commit
f9ef45ad43
1 changed files with 16 additions and 4 deletions
|
@ -981,11 +981,23 @@ 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
|
||||||
|
BUG_ON(bkey_cmp(iter->pos,
|
||||||
(iter->flags & BTREE_ITER_IS_EXTENTS)
|
(iter->flags & BTREE_ITER_IS_EXTENTS)
|
||||||
? bkey_start_pos(&k->k)
|
? bkey_start_pos(&k->k)
|
||||||
: k->k.p));
|
: 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;
|
||||||
|
|
||||||
if (btree_node_type_is_extents(iter->btree_id)) {
|
if (btree_node_type_is_extents(iter->btree_id)) {
|
||||||
|
|
Loading…
Reference in a new issue