bcachefs: Drop empty accounting updates

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet
2025-05-21 15:54:56 -04:00
parent 136d082abc
commit bfc0c6fecf

View File

@@ -111,6 +111,16 @@ int bch2_disk_accounting_mod(struct btree_trans *trans,
if (bpos_eq(a->k.p, pos)) {
BUG_ON(nr != bch2_accounting_counters(&a->k));
acc_u64s(a->v.d, d, nr);
if (bch2_accounting_key_is_zero(accounting_i_to_s_c(a))) {
unsigned offset = (u64 *) a -
(u64 *) btree_trans_subbuf_base(trans, &trans->accounting);
trans->accounting.u64s -= a->k.u64s;
memmove_u64s_down(a,
bkey_next(&a->k_i),
trans->accounting.u64s - offset);
}
return 0;
}
#endif