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 <[email protected]>
---
 fs/bcachefs/alloc_background.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index 97c2df18dfa4..c5c8497a6339 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -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);
-- 
2.45.2


Reply via email to