]> www.infradead.org Git - users/hch/misc.git/commitdiff
bcachefs: Advance bch_alloc.oldest_gen if no stale pointers
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 8 Feb 2025 00:56:11 +0000 (19:56 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sat, 15 Mar 2025 01:02:14 +0000 (21:02 -0400)
Now that we've got cached backpointers and aren't leaving around stale
pointers on bucket invalidation, we no longer need the periodic (rare)
gc_gens - which recalculates each bucket's oldest gen to avoid wraparound.

We can't delete that code because we've got to support existing
filesystems that will still have stale pointers, but this gets rid of
another scalability limit.

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

index 97c2df18dfa470eb651661227f6ee7bc8afcad29..c5c8497a6339c6fa732005130ead95f88633ca0c 100644 (file)
@@ -871,6 +871,9 @@ int bch2_trigger_alloc(struct btree_trans *trans,
                if (data_type_is_empty(new_a->data_type) &&
                    BCH_ALLOC_V4_NEED_INC_GEN(new_a) &&
                    !bch2_bucket_is_open_safe(c, new.k->p.inode, new.k->p.offset)) {
+                       if (new_a->oldest_gen == new_a->gen &&
+                           !bch2_bucket_sectors_total(*new_a))
+                               new_a->oldest_gen++;
                        new_a->gen++;
                        SET_BCH_ALLOC_V4_NEED_INC_GEN(new_a, false);
                        alloc_data_type_set(new_a, new_a->data_type);