summaryrefslogtreecommitdiff
path: root/fs/bcachefs/btree_iter.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-10-25 18:30:28 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:15 -0400
commitd121172561d670c8152559614b3575322d709d8d (patch)
tree4dfc8c029a1441753a5e3c2ad1aa3e298b0e787c /fs/bcachefs/btree_iter.h
parent396a887d8fdf37d9e3e9a5b2db823184f8ec2eaa (diff)
downloadlwn-d121172561d670c8152559614b3575322d709d8d.tar.gz
lwn-d121172561d670c8152559614b3575322d709d8d.zip
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>
Diffstat (limited to 'fs/bcachefs/btree_iter.h')
-rw-r--r--fs/bcachefs/btree_iter.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/bcachefs/btree_iter.h b/fs/bcachefs/btree_iter.h
index e58cad4b8fc6..16fa0fe1c5b7 100644
--- a/fs/bcachefs/btree_iter.h
+++ b/fs/bcachefs/btree_iter.h
@@ -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;