]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
bcachefs: Drop extra pointers when marking data as in a stripe
authorKent Overstreet <kent.overstreet@gmail.com>
Sat, 11 Jul 2020 17:23:17 +0000 (13:23 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:42 +0000 (17:08 -0400)
We ideally want the buckets used for the extra initial replicas to be
reused right away.

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

index 43f4b2f0d1bfcb7884de2c833b2c6a1057f0d006..54a95edc9901547fa18168d7ddf12d695ba55a16 100644 (file)
@@ -784,12 +784,9 @@ static int ec_stripe_update_ptrs(struct bch_fs *c,
                bkey_on_stack_reassemble(&sk, c, k);
                e = bkey_i_to_s_extent(sk.k);
 
-               extent_for_each_ptr(e, ptr) {
-                       if (ptr->dev == dev)
-                               ec_ptr = ptr;
-                       else
-                               ptr->cached = true;
-               }
+               bch2_bkey_drop_ptrs(e.s, ptr, ptr->dev != dev);
+               ec_ptr = (void *) bch2_bkey_has_device(e.s_c, dev);
+               BUG_ON(!ec_ptr);
 
                extent_stripe_ptr_add(e, s, ec_ptr, idx);