diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-12-05 12:35:43 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-12-21 01:36:22 -0500 |
commit | 44a43cf9fdccc3576b1f2a96dc3e0dc87796bedb (patch) | |
tree | 9bec7f5fe7e9a7d7252995cb7a859211d06e2ba3 /fs/bcachefs/disk_accounting.c | |
parent | 60558d55f7e26c8aa2242718461642792fa200a4 (diff) |
bcachefs: Don't add unknown accounting types to eytzinger tree
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/disk_accounting.c')
-rw-r--r-- | fs/bcachefs/disk_accounting.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/bcachefs/disk_accounting.c b/fs/bcachefs/disk_accounting.c index a0061bcf9159..b18cbe80936b 100644 --- a/fs/bcachefs/disk_accounting.c +++ b/fs/bcachefs/disk_accounting.c @@ -729,6 +729,16 @@ int bch2_accounting_read(struct bch_fs *c) BTREE_ITER_prefetch|BTREE_ITER_all_snapshots, k, ({ struct bkey u; struct bkey_s_c k = bch2_btree_path_peek_slot_exact(btree_iter_path(trans, &iter), &u); + + if (k.k->type != KEY_TYPE_accounting) + continue; + + struct disk_accounting_pos acc_k; + bpos_to_disk_accounting_pos(&acc_k, k.k->p); + + if (!bch2_accounting_is_mem(acc_k)) + continue; + accounting_read_key(trans, k); })); if (ret) @@ -740,6 +750,12 @@ int bch2_accounting_read(struct bch_fs *c) darray_for_each(*keys, i) { if (i->k->k.type == KEY_TYPE_accounting) { + struct disk_accounting_pos acc_k; + bpos_to_disk_accounting_pos(&acc_k, i->k->k.p); + + if (!bch2_accounting_is_mem(acc_k)) + continue; + struct bkey_s_c k = bkey_i_to_s_c(i->k); unsigned idx = eytzinger0_find(acc->k.data, acc->k.nr, sizeof(acc->k.data[0]), |