From 4254f5bf6e3d62ab7108a556d5afc54188e17041 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Sun, 3 Apr 2022 15:13:20 -0400 Subject: [PATCH] bcachefs: Add a tracepoint for superblock writes Signed-off-by: Kent Overstreet --- fs/bcachefs/super-io.c | 3 +++ fs/bcachefs/trace.h | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c index 4fb2bede39f6..7e885b51349e 100644 --- a/fs/bcachefs/super-io.c +++ b/fs/bcachefs/super-io.c @@ -16,6 +16,7 @@ #include "quota.h" #include "super-io.h" #include "super.h" +#include "trace.h" #include "vstructs.h" #include @@ -799,6 +800,8 @@ int bch2_write_super(struct bch_fs *c) unsigned degraded_flags = BCH_FORCE_IF_DEGRADED; int ret = 0; + trace_write_super(c, _RET_IP_); + if (c->opts.very_degraded) degraded_flags |= BCH_FORCE_IF_LOST; diff --git a/fs/bcachefs/trace.h b/fs/bcachefs/trace.h index ef2096fd147d..eeacb5291764 100644 --- a/fs/bcachefs/trace.h +++ b/fs/bcachefs/trace.h @@ -82,6 +82,26 @@ DECLARE_EVENT_CLASS(bio, (unsigned long long)__entry->sector, __entry->nr_sector) ); +/* super-io.c: */ +TRACE_EVENT(write_super, + TP_PROTO(struct bch_fs *c, unsigned long ip), + TP_ARGS(c, ip), + + TP_STRUCT__entry( + __field(dev_t, dev ) + __field(unsigned long, ip ) + ), + + TP_fast_assign( + __entry->dev = c->dev; + __entry->ip = ip; + ), + + TP_printk("%d,%d for %pS", + MAJOR(__entry->dev), MINOR(__entry->dev), + (void *) __entry->ip) +); + /* io.c: */ DEFINE_EVENT(bio, read_split,