From f73e6bb6d6c70b72aff021237b8c4722cc43a919 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Thu, 6 Jun 2024 13:48:54 -0400 Subject: bcachefs: bch2_accounting_mem_gc() Add a new helper to free zeroed out accounting entries, and use it in bch2_replicas_gc2(); bch2_replicas_gc2() was killing superblock replicas entries if their corresponding accounting counters were nonzero, but that's incorrect - the superblock replicas entry needs to exist if the accounting entry exists, not if it's nonzero, because we check and create the replicas entry when creating the new accounting entry - we don't know when it's becoming nonzero. Signed-off-by: Kent Overstreet --- fs/bcachefs/disk_accounting.h | 1 + 1 file changed, 1 insertion(+) (limited to 'fs/bcachefs/disk_accounting.h') diff --git a/fs/bcachefs/disk_accounting.h b/fs/bcachefs/disk_accounting.h index 81dab01d1eb8..3d3f25e08b69 100644 --- a/fs/bcachefs/disk_accounting.h +++ b/fs/bcachefs/disk_accounting.h @@ -105,6 +105,7 @@ static inline int accounting_pos_cmp(const void *_l, const void *_r) } int bch2_accounting_mem_insert(struct bch_fs *, struct bkey_s_c_accounting, bool); +void bch2_accounting_mem_gc(struct bch_fs *); static inline int __bch2_accounting_mem_mod(struct bch_fs *c, struct bkey_s_c_accounting a, bool gc) { -- cgit v1.2.3