Skip to content

Commit 486d920

Browse files
author
Kent Overstreet
committed
bcachefs: disk accounting: ignore unknown types
forward compat fix Signed-off-by: Kent Overstreet <[email protected]>
1 parent d9e6157 commit 486d920

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

fs/bcachefs/disk_accounting.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,9 @@ int bch2_gc_accounting_done(struct bch_fs *c)
528528
struct disk_accounting_pos acc_k;
529529
bpos_to_disk_accounting_pos(&acc_k, e->pos);
530530

531+
if (acc_k.type >= BCH_DISK_ACCOUNTING_TYPE_NR)
532+
continue;
533+
531534
u64 src_v[BCH_ACCOUNTING_MAX_COUNTERS];
532535
u64 dst_v[BCH_ACCOUNTING_MAX_COUNTERS];
533536

@@ -760,6 +763,12 @@ void bch2_verify_accounting_clean(struct bch_fs *c)
760763
struct bkey_s_c_accounting a = bkey_s_c_to_accounting(k);
761764
unsigned nr = bch2_accounting_counters(k.k);
762765

766+
struct disk_accounting_pos acc_k;
767+
bpos_to_disk_accounting_pos(&acc_k, k.k->p);
768+
769+
if (acc_k.type >= BCH_DISK_ACCOUNTING_TYPE_NR)
770+
continue;
771+
763772
bch2_accounting_mem_read(c, k.k->p, v, nr);
764773

765774
if (memcmp(a.v->d, v, nr * sizeof(u64))) {
@@ -775,9 +784,6 @@ void bch2_verify_accounting_clean(struct bch_fs *c)
775784
mismatch = true;
776785
}
777786

778-
struct disk_accounting_pos acc_k;
779-
bpos_to_disk_accounting_pos(&acc_k, a.k->p);
780-
781787
switch (acc_k.type) {
782788
case BCH_DISK_ACCOUNTING_persistent_reserved:
783789
base.reserved += acc_k.persistent_reserved.nr_replicas * a.v->d[0];

0 commit comments

Comments
 (0)