mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-01 06:33:07 +00:00
bcachefs: ec_stripe_bkey_insert() -> for_each_btree_key_norestart()
With the upcoming patches to add assertions for incorrect nested transaction restart handling, this code is now bogus. Switch it to for_each_btree_key_norestart() so that transaction restarts are only handled in one place. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
parent
0a5156334c
commit
175379db20
1 changed files with 6 additions and 7 deletions
|
@ -726,7 +726,7 @@ static int ec_stripe_bkey_insert(struct btree_trans *trans,
|
||||||
struct bpos start_pos = bpos_max(min_pos, POS(0, c->ec_stripe_hint));
|
struct bpos start_pos = bpos_max(min_pos, POS(0, c->ec_stripe_hint));
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
for_each_btree_key(trans, iter, BTREE_ID_stripes, start_pos,
|
for_each_btree_key_norestart(trans, iter, BTREE_ID_stripes, start_pos,
|
||||||
BTREE_ITER_SLOTS|BTREE_ITER_INTENT, k, ret) {
|
BTREE_ITER_SLOTS|BTREE_ITER_INTENT, k, ret) {
|
||||||
if (bkey_cmp(k.k->p, POS(0, U32_MAX)) > 0) {
|
if (bkey_cmp(k.k->p, POS(0, U32_MAX)) > 0) {
|
||||||
if (start_pos.offset) {
|
if (start_pos.offset) {
|
||||||
|
@ -740,12 +740,13 @@ static int ec_stripe_bkey_insert(struct btree_trans *trans,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bkey_deleted(k.k))
|
if (bkey_deleted(k.k))
|
||||||
goto found_slot;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
goto err;
|
c->ec_stripe_hint = iter.pos.offset;
|
||||||
found_slot:
|
|
||||||
start_pos = iter.pos;
|
if (ret)
|
||||||
|
goto err;
|
||||||
|
|
||||||
ret = ec_stripe_mem_alloc(trans, &iter);
|
ret = ec_stripe_mem_alloc(trans, &iter);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -754,8 +755,6 @@ static int ec_stripe_bkey_insert(struct btree_trans *trans,
|
||||||
stripe->k.p = iter.pos;
|
stripe->k.p = iter.pos;
|
||||||
|
|
||||||
ret = bch2_trans_update(trans, &iter, &stripe->k_i, 0);
|
ret = bch2_trans_update(trans, &iter, &stripe->k_i, 0);
|
||||||
|
|
||||||
c->ec_stripe_hint = start_pos.offset;
|
|
||||||
err:
|
err:
|
||||||
bch2_trans_iter_exit(trans, &iter);
|
bch2_trans_iter_exit(trans, &iter);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue