bcachefs: More general fix for transaction paths overflow

for_each_btree_key() now calls bch2_trans_begin() as needed; that means,
we can also call it when we're in danger of overflowing transaction
paths.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
Kent Overstreet 2021-10-25 18:30:28 -04:00 committed by Kent Overstreet
parent 396a887d8f
commit d121172561

View File

@ -329,8 +329,9 @@ __bch2_btree_iter_peek_and_restart(struct btree_trans *trans,
{
struct bkey_s_c k;
while (k = __bch2_btree_iter_peek(iter, flags),
bkey_err(k) == -EINTR)
while ((hweight64(trans->paths_allocated) > BTREE_ITER_MAX / 2) ||
(k = __bch2_btree_iter_peek(iter, flags),
bkey_err(k) == -EINTR))
bch2_trans_begin(trans);
return k;