Commit 137b0ed9 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: bch2_extent_atomic_end() now traverses iter

This fixes a bug in io.c bch2_write_index_default() - it was missing the
traverse call, but bch2_extent_atomic_end returns an error now and can
just call it itself.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 96385742
......@@ -1010,13 +1010,19 @@ int bch2_extent_atomic_end(struct btree_iter *iter,
struct bpos *end)
{
struct btree_trans *trans = iter->trans;
struct btree *b = iter->l[0].b;
struct btree_node_iter node_iter = iter->l[0].iter;
struct btree *b;
struct btree_node_iter node_iter;
struct bkey_packed *_k;
unsigned nr_iters = 0;
int ret;
BUG_ON(iter->uptodate > BTREE_ITER_NEED_PEEK);
ret = bch2_btree_iter_traverse(iter);
if (ret)
return ret;
b = iter->l[0].b;
node_iter = iter->l[0].iter;
BUG_ON(bkey_cmp(bkey_start_pos(&insert->k), b->data->min_key) < 0);
*end = bpos_min(insert->k.p, b->key.k.p);
......
......@@ -297,10 +297,6 @@ int bch2_extent_update(struct btree_trans *trans,
s64 i_sectors_delta;
int ret;
ret = bch2_btree_iter_traverse(extent_iter);
if (ret)
return ret;
ret = bch2_extent_trim_atomic(k, extent_iter);
if (ret)
return ret;
......@@ -2695,10 +2691,6 @@ static long bch2_fcollapse_finsert(struct bch_inode_info *inode,
copy.k.k.p.offset += shift >> 9;
bch2_btree_iter_set_pos(dst, bkey_start_pos(&copy.k.k));
ret = bch2_btree_iter_traverse(dst);
if (ret)
goto bkey_err;
ret = bch2_extent_atomic_end(dst, &copy.k, &atomic_end);
if (ret)
goto bkey_err;
......
......@@ -268,7 +268,7 @@ static int bch2_extent_replay_key(struct bch_fs *c, enum btree_id btree_id,
BTREE_ITER_INTENT);
do {
ret = bch2_btree_iter_traverse(iter);
ret = bch2_extent_atomic_end(iter, k, &atomic_end);
if (ret)
goto err;
......@@ -282,10 +282,6 @@ static int bch2_extent_replay_key(struct bch_fs *c, enum btree_id btree_id,
if (ret)
goto err;
ret = bch2_extent_atomic_end(split_iter, k, &atomic_end);
if (ret)
goto err;
if (!remark &&
remark_if_split &&
bkey_cmp(atomic_end, k->k.p) < 0) {
......
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