bcachefs: Add a tracepoint for copygc waiting
authorKent Overstreet <kent.overstreet@gmail.com>
Wed, 26 May 2021 05:03:35 +0000 (01:03 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:04 +0000 (17:09 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/movinggc.c
fs/bcachefs/trace.h

index e8f9d70af93021e5e54e5c594a1a25cd62effa32..b805371fe99f8b7487166f3f3b3512769e71b82a 100644 (file)
@@ -326,6 +326,7 @@ static int bch2_copygc_thread(void *arg)
                wait = bch2_copygc_wait_amount(c);
 
                if (wait > clock->max_slop) {
+                       trace_copygc_wait(c, wait, last + wait);
                        c->copygc_wait = last + wait;
                        bch2_kthread_io_clock_wait(clock, last + wait,
                                        MAX_SCHEDULE_TIMEOUT);
index b0a696ae4fc10b3f823a1f7fad5cac44197bfe68..1f62d82624bd5e39b52821da0cf1c426c83deef8 100644 (file)
@@ -528,6 +528,27 @@ TRACE_EVENT(copygc,
                __entry->buckets_moved, __entry->buckets_not_moved)
 );
 
+TRACE_EVENT(copygc_wait,
+       TP_PROTO(struct bch_fs *c,
+                u64 wait_amount, u64 until),
+       TP_ARGS(c, wait_amount, until),
+
+       TP_STRUCT__entry(
+               __array(char,           uuid,   16              )
+               __field(u64,            wait_amount             )
+               __field(u64,            until                   )
+       ),
+
+       TP_fast_assign(
+               memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
+               __entry->wait_amount    = wait_amount;
+               __entry->until          = until;
+       ),
+
+       TP_printk("%pU waiting for %llu sectors until %llu",
+               __entry->uuid, __entry->wait_amount, __entry->until)
+);
+
 TRACE_EVENT(trans_get_iter,
        TP_PROTO(unsigned long caller, unsigned long ip,
                 enum btree_id btree_id,