]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
bcachefs: Fix another iterator counting bug
authorKent Overstreet <kent.overstreet@gmail.com>
Fri, 15 May 2020 01:45:08 +0000 (21:45 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:39 +0000 (17:08 -0400)
We were marking the end of where we could insert incorrectly for
indirect extents.

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

index d0af1bc17018ad2c8c56a9fa9aa9cda1a655b30e..fd011df3cb9943b2dd9c2ae0f3a80191263c5b41 100644 (file)
@@ -76,7 +76,8 @@ static int count_iters_for_insert(struct btree_trans *trans,
 
                        if (*nr_iters >= max_iters) {
                                struct bpos pos = bkey_start_pos(k.k);
-                               pos.offset += r_k.k->p.offset - idx;
+                               pos.offset += min_t(u64, k.k->size,
+                                                   r_k.k->p.offset - idx);
 
                                *end = bpos_min(*end, pos);
                                ret = 1;