75 lines
2.1 KiB
Diff
75 lines
2.1 KiB
Diff
From 2a21c9dea9ea0babf4adcbab544204ae50ae8164 Mon Sep 17 00:00:00 2001
|
|
From: Kent Overstreet <kent.overstreet@linux.dev>
|
|
Date: Wed, 4 Dec 2024 17:44:25 -0500
|
|
Subject: [PATCH 164/233] bcachefs: trace_accounting_mem_insert
|
|
Content-Type: text/plain; charset="utf-8"
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
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>
|
|
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
|
---
|
|
fs/bcachefs/disk_accounting.c | 8 ++++++++
|
|
fs/bcachefs/trace.h | 24 ++++++++++++++++++++++++
|
|
2 files changed, 32 insertions(+)
|
|
|
|
diff --git a/fs/bcachefs/disk_accounting.c b/fs/bcachefs/disk_accounting.c
|
|
index a915d9dc8de4..a0061bcf9159 100644
|
|
--- a/fs/bcachefs/disk_accounting.c
|
|
+++ b/fs/bcachefs/disk_accounting.c
|
|
@@ -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]);
|
|
diff --git a/fs/bcachefs/trace.h b/fs/bcachefs/trace.h
|
|
index 2d5932d2881e..7baf66beee22 100644
|
|
--- a/fs/bcachefs/trace.h
|
|
+++ b/fs/bcachefs/trace.h
|
|
@@ -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),
|
|
--
|
|
2.45.2
|
|
|