bcachefs: Kill retry loop in btree merge path

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
Kent Overstreet 2021-09-05 00:22:32 -04:00 committed by Kent Overstreet
parent f48361b00c
commit 22b383ad7e
2 changed files with 6 additions and 34 deletions

View File

@ -1572,12 +1572,7 @@ int __bch2_foreground_maybe_merge(struct btree_trans *trans,
struct btree *b, *m, *n, *prev, *next, *parent;
struct bpos sib_pos;
size_t sib_u64s;
int ret = 0, ret2 = 0;
retry:
ret = bch2_btree_path_traverse(trans, path, false);
if (ret)
return ret;
int ret = 0;
BUG_ON(!path->should_be_locked);
BUG_ON(!btree_node_locked(path, level));
@ -1587,7 +1582,7 @@ retry:
if ((sib == btree_prev_sib && !bpos_cmp(b->data->min_key, POS_MIN)) ||
(sib == btree_next_sib && !bpos_cmp(b->data->max_key, SPOS_MAX))) {
b->sib_u64s[sib] = U16_MAX;
goto out;
return 0;
}
sib_pos = sib == btree_prev_sib
@ -1715,29 +1710,10 @@ retry:
bch2_btree_update_done(as);
out:
bch2_trans_verify_locks(trans);
if (sib_path)
bch2_path_put(trans, sib_path, true);
/*
* Don't downgrade locks here: we're called after successful insert,
* and the caller will downgrade locks after a successful insert
* anyways (in case e.g. a split was required first)
*
* And we're also called when inserting into interior nodes in the
* split path, and downgrading to read locks in there is potentially
* confusing:
*/
return ret ?: ret2;
err:
if (sib_path)
bch2_path_put(trans, sib_path, true);
sib_path = NULL;
if (ret == -EINTR && bch2_trans_relock(trans))
goto retry;
goto out;
bch2_path_put(trans, sib_path, true);
bch2_trans_verify_locks(trans);
return ret;
}
/**

View File

@ -129,11 +129,7 @@ static inline int bch2_foreground_maybe_merge_sibling(struct btree_trans *trans,
{
struct btree *b;
if (path->uptodate >= BTREE_ITER_NEED_TRAVERSE)
return 0;
if (!bch2_btree_node_relock(trans, path, level))
return 0;
EBUG_ON(!btree_node_locked(path, level));
b = path->l[level].b;
if (b->sib_u64s[sib] > trans->c->btree_foreground_merge_threshold)