bcachefs: Fix a trans path overflow in bch2_btree_delete_range_trans()
authorKent Overstreet <kent.overstreet@linux.dev>
Wed, 28 Sep 2022 14:16:57 +0000 (10:16 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:42 +0000 (17:09 -0400)
commit685e0f0c477dfc2b2147a20137a349f25b0a1f62
tree10b823a41df53f79845364acf00ebf15d1aca065
parentae10fe017bf54653a61a93e49fac1c3e2b474e20
bcachefs: Fix a trans path overflow in bch2_btree_delete_range_trans()

bch2_btree_delete_range_trans() was using btree_trans_too_many_iters()
to avoid path overflow, but this was buggy here (and also
btree_trans_too_many_iters() is suspect in general).

btree_trans_too_many_iters() only returns true when we're close to the
maximum number of paths - within 8 - but extent insert/delete assumes
that it can use more paths than that.

Instead, we need to call bch2_trans_begin() on every loop iteration.
Since we don't want to call bch2_trans_begin() (restarting the outer
transaction) if the call was a no-op - if we had no work to do - we have
to structure things a bit oddly.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_update_leaf.c