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

bcachefs: Fix incorrect use of bch2_extent_atomic_end()

bch2_extent_atomic_end counts the number of iterators requried for
marking overwrites - but journal replay never marks overwrites, so that
part was incorrect. And counting iterators for the key being inserted
should be unnecessary because we did that prior to the key being
inserted before it was first journalled.

This should fix an iterator overflow bug - the iterators for walking
overwrites were totally unneeded.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 63fbf458
...@@ -268,10 +268,12 @@ static int bch2_extent_replay_key(struct bch_fs *c, enum btree_id btree_id, ...@@ -268,10 +268,12 @@ static int bch2_extent_replay_key(struct bch_fs *c, enum btree_id btree_id,
BTREE_ITER_INTENT); BTREE_ITER_INTENT);
do { do {
ret = bch2_extent_atomic_end(iter, k, &atomic_end); ret = bch2_btree_iter_traverse(iter);
if (ret) if (ret)
goto err; goto err;
atomic_end = bpos_min(k->k.p, iter->l[0].b->key.k.p);
split_iter = bch2_trans_copy_iter(&trans, iter); split_iter = bch2_trans_copy_iter(&trans, iter);
ret = PTR_ERR_OR_ZERO(split_iter); ret = PTR_ERR_OR_ZERO(split_iter);
if (ret) if (ret)
......
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