Skip to content

Commit bfc0c6f

Browse files
author
Kent Overstreet
committed
bcachefs: Drop empty accounting updates
Signed-off-by: Kent Overstreet <[email protected]>
1 parent 136d082 commit bfc0c6f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

fs/bcachefs/disk_accounting.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,16 @@ int bch2_disk_accounting_mod(struct btree_trans *trans,
111111
if (bpos_eq(a->k.p, pos)) {
112112
BUG_ON(nr != bch2_accounting_counters(&a->k));
113113
acc_u64s(a->v.d, d, nr);
114+
115+
if (bch2_accounting_key_is_zero(accounting_i_to_s_c(a))) {
116+
unsigned offset = (u64 *) a -
117+
(u64 *) btree_trans_subbuf_base(trans, &trans->accounting);
118+
119+
trans->accounting.u64s -= a->k.u64s;
120+
memmove_u64s_down(a,
121+
bkey_next(&a->k_i),
122+
trans->accounting.u64s - offset);
123+
}
114124
return 0;
115125
}
116126
#endif

0 commit comments

Comments
 (0)