bcachefs: trace_accounting_mem_insert

Add a tracepoint for inserting new accounting entries: we're seeing odd
spinning behaviour in accounting read.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet
2024-12-04 17:44:25 -05:00
parent e3474394eb
commit 400af9a398
2 changed files with 32 additions and 0 deletions

View File

@@ -324,6 +324,14 @@ static int __bch2_accounting_mem_insert(struct bch_fs *c, struct bkey_s_c_accoun
eytzinger0_sort(acc->k.data, acc->k.nr, sizeof(acc->k.data[0]),
accounting_pos_cmp, NULL);
if (trace_accounting_mem_insert_enabled()) {
struct printbuf buf = PRINTBUF;
bch2_accounting_to_text(&buf, c, a.s_c);
trace_accounting_mem_insert(c, buf.buf);
printbuf_exit(&buf);
}
return 0;
err:
free_percpu(n.v[1]);

View File

@@ -199,6 +199,30 @@ DECLARE_EVENT_CLASS(bio,
(unsigned long long)__entry->sector, __entry->nr_sector)
);
/* disk_accounting.c */
TRACE_EVENT(accounting_mem_insert,
TP_PROTO(struct bch_fs *c, const char *acc),
TP_ARGS(c, acc),
TP_STRUCT__entry(
__field(dev_t, dev )
__field(unsigned, new_nr )
__string(acc, acc )
),
TP_fast_assign(
__entry->dev = c->dev;
__entry->new_nr = c->accounting.k.nr;
__assign_str(acc);
),
TP_printk("%d,%d entries %u added %s",
MAJOR(__entry->dev), MINOR(__entry->dev),
__entry->new_nr,
__get_str(acc))
);
/* fs.c: */
TRACE_EVENT(bch2_sync_fs,
TP_PROTO(struct super_block *sb, int wait),