80 lines
2.7 KiB
Diff
80 lines
2.7 KiB
Diff
From 42c1d1a9549ce73cc877d785f67e0152cacfd279 Mon Sep 17 00:00:00 2001
|
|
From: Kent Overstreet <kent.overstreet@linux.dev>
|
|
Date: Tue, 10 Dec 2024 10:29:12 -0500
|
|
Subject: [PATCH 194/233] bcachefs: trace_write_buffer_maybe_flush
|
|
Content-Type: text/plain; charset="utf-8"
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
|
|
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
|
---
|
|
fs/bcachefs/backpointers.c | 2 +-
|
|
fs/bcachefs/btree_write_buffer.c | 8 ++++++++
|
|
fs/bcachefs/trace.h | 18 ++++++++++++++++++
|
|
3 files changed, 27 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/fs/bcachefs/backpointers.c b/fs/bcachefs/backpointers.c
|
|
index 702bf62d7fa7..0e3b7b5d626e 100644
|
|
--- a/fs/bcachefs/backpointers.c
|
|
+++ b/fs/bcachefs/backpointers.c
|
|
@@ -206,7 +206,7 @@ static int bch2_backpointer_del(struct btree_trans *trans, struct bpos pos)
|
|
: bch2_btree_delete(trans, BTREE_ID_backpointers, pos, 0);
|
|
}
|
|
|
|
-static int bch2_backpointers_maybe_flush(struct btree_trans *trans,
|
|
+static inline int bch2_backpointers_maybe_flush(struct btree_trans *trans,
|
|
struct bkey_s_c visiting_k,
|
|
struct bkey_buf *last_flushed)
|
|
{
|
|
diff --git a/fs/bcachefs/btree_write_buffer.c b/fs/bcachefs/btree_write_buffer.c
|
|
index 49ce2d1e5c02..746db6d5a0fb 100644
|
|
--- a/fs/bcachefs/btree_write_buffer.c
|
|
+++ b/fs/bcachefs/btree_write_buffer.c
|
|
@@ -632,6 +632,14 @@ int bch2_btree_write_buffer_maybe_flush(struct btree_trans *trans,
|
|
bch2_bkey_buf_init(&tmp);
|
|
|
|
if (!bkey_and_val_eq(referring_k, bkey_i_to_s_c(last_flushed->k))) {
|
|
+ if (trace_write_buffer_maybe_flush_enabled()) {
|
|
+ struct printbuf buf = PRINTBUF;
|
|
+
|
|
+ bch2_bkey_val_to_text(&buf, c, referring_k);
|
|
+ trace_write_buffer_maybe_flush(trans, _RET_IP_, buf.buf);
|
|
+ printbuf_exit(&buf);
|
|
+ }
|
|
+
|
|
bch2_bkey_buf_reassemble(&tmp, c, referring_k);
|
|
|
|
if (bkey_is_btree_ptr(referring_k.k)) {
|
|
diff --git a/fs/bcachefs/trace.h b/fs/bcachefs/trace.h
|
|
index 7baf66beee22..11e6547f91d6 100644
|
|
--- a/fs/bcachefs/trace.h
|
|
+++ b/fs/bcachefs/trace.h
|
|
@@ -1436,6 +1436,24 @@ TRACE_EVENT(write_buffer_flush_slowpath,
|
|
TP_printk("%zu/%zu", __entry->slowpath, __entry->total)
|
|
);
|
|
|
|
+TRACE_EVENT(write_buffer_maybe_flush,
|
|
+ TP_PROTO(struct btree_trans *trans, unsigned long caller_ip, const char *key),
|
|
+ TP_ARGS(trans, caller_ip, key),
|
|
+
|
|
+ TP_STRUCT__entry(
|
|
+ __array(char, trans_fn, 32 )
|
|
+ __field(unsigned long, caller_ip )
|
|
+ __string(key, key )
|
|
+ ),
|
|
+
|
|
+ TP_fast_assign(
|
|
+ strscpy(__entry->trans_fn, trans->fn, sizeof(__entry->trans_fn));
|
|
+ __assign_str(key);
|
|
+ ),
|
|
+
|
|
+ TP_printk("%s %pS %s", __entry->trans_fn, (void *) __entry->caller_ip, __get_str(key))
|
|
+);
|
|
+
|
|
DEFINE_EVENT(fs_str, rebalance_extent,
|
|
TP_PROTO(struct bch_fs *c, const char *str),
|
|
TP_ARGS(c, str)
|
|
--
|
|
2.45.2
|
|
|