Commit 486d9207 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: disk accounting: ignore unknown types

forward compat fix
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent d9e61576
...@@ -528,6 +528,9 @@ int bch2_gc_accounting_done(struct bch_fs *c) ...@@ -528,6 +528,9 @@ int bch2_gc_accounting_done(struct bch_fs *c)
struct disk_accounting_pos acc_k; struct disk_accounting_pos acc_k;
bpos_to_disk_accounting_pos(&acc_k, e->pos); bpos_to_disk_accounting_pos(&acc_k, e->pos);
if (acc_k.type >= BCH_DISK_ACCOUNTING_TYPE_NR)
continue;
u64 src_v[BCH_ACCOUNTING_MAX_COUNTERS]; u64 src_v[BCH_ACCOUNTING_MAX_COUNTERS];
u64 dst_v[BCH_ACCOUNTING_MAX_COUNTERS]; u64 dst_v[BCH_ACCOUNTING_MAX_COUNTERS];
...@@ -760,6 +763,12 @@ void bch2_verify_accounting_clean(struct bch_fs *c) ...@@ -760,6 +763,12 @@ void bch2_verify_accounting_clean(struct bch_fs *c)
struct bkey_s_c_accounting a = bkey_s_c_to_accounting(k); struct bkey_s_c_accounting a = bkey_s_c_to_accounting(k);
unsigned nr = bch2_accounting_counters(k.k); unsigned nr = bch2_accounting_counters(k.k);
struct disk_accounting_pos acc_k;
bpos_to_disk_accounting_pos(&acc_k, k.k->p);
if (acc_k.type >= BCH_DISK_ACCOUNTING_TYPE_NR)
continue;
bch2_accounting_mem_read(c, k.k->p, v, nr); bch2_accounting_mem_read(c, k.k->p, v, nr);
if (memcmp(a.v->d, v, nr * sizeof(u64))) { if (memcmp(a.v->d, v, nr * sizeof(u64))) {
...@@ -775,9 +784,6 @@ void bch2_verify_accounting_clean(struct bch_fs *c) ...@@ -775,9 +784,6 @@ void bch2_verify_accounting_clean(struct bch_fs *c)
mismatch = true; mismatch = true;
} }
struct disk_accounting_pos acc_k;
bpos_to_disk_accounting_pos(&acc_k, a.k->p);
switch (acc_k.type) { switch (acc_k.type) {
case BCH_DISK_ACCOUNTING_persistent_reserved: case BCH_DISK_ACCOUNTING_persistent_reserved:
base.reserved += acc_k.persistent_reserved.nr_replicas * a.v->d[0]; base.reserved += acc_k.persistent_reserved.nr_replicas * a.v->d[0];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment