summaryrefslogtreecommitdiff
path: root/fs/bcachefs/extent_update.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-10-11 04:32:41 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:50 -0400
commitc72f687a1ff1801b404fab804fdddcaf034e6ef4 (patch)
tree53648acc4521cf44688250b6402edf871bec0781 /fs/bcachefs/extent_update.c
parent5b3008bc6182e56fdd5ba36fdf324430d0792e0c (diff)
bcachefs: Use for_each_btree_key_upto() more consistently
It's important that in BTREE_ITER_FILTER_SNAPSHOTS mode we always use peek_upto() and provide an end for the interval we're searching for - otherwise, when we hit the end of the inode the next inode be in a different subvolume and not have any keys in the current snapshot, and we'd iterate over arbitrarily many keys before returning one. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/extent_update.c')
-rw-r--r--fs/bcachefs/extent_update.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/fs/bcachefs/extent_update.c b/fs/bcachefs/extent_update.c
index 21d6f88c7397..21af6fb8cecf 100644
--- a/fs/bcachefs/extent_update.c
+++ b/fs/bcachefs/extent_update.c
@@ -128,12 +128,9 @@ int bch2_extent_atomic_end(struct btree_trans *trans,
bch2_trans_copy_iter(&copy, iter);
- for_each_btree_key_continue_norestart(copy, 0, k, ret) {
+ for_each_btree_key_upto_continue_norestart(copy, insert->k.p, 0, k, ret) {
unsigned offset = 0;
- if (bkey_ge(bkey_start_pos(k.k), *end))
- break;
-
if (bkey_gt(bkey_start_pos(&insert->k), bkey_start_pos(k.k)))
offset = bkey_start_offset(&insert->k) -
bkey_start_offset(k.k);