bcachefs: Add a few tracepoints
authorKent Overstreet <kent.overstreet@gmail.com>
Sat, 11 Apr 2020 16:32:27 +0000 (12:32 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:38 +0000 (17:08 -0400)
Transaction restart tracing should probably be overhaulled at some
point.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_update_interior.c
fs/bcachefs/trace.h

index 772595b3da9f22d72b26098b717d5de9114f486e..153d13b9c96e68908972486c6338770a24db87b8 100644 (file)
@@ -1555,8 +1555,10 @@ int bch2_btree_split_leaf(struct bch_fs *c, struct btree_iter *iter,
        /* Hack, because gc and splitting nodes doesn't mix yet: */
        if (!(flags & BTREE_INSERT_GC_LOCK_HELD) &&
            !down_read_trylock(&c->gc_lock)) {
-               if (flags & BTREE_INSERT_NOUNLOCK)
+               if (flags & BTREE_INSERT_NOUNLOCK) {
+                       trace_transaction_restart_ip(trans->ip, _THIS_IP_);
                        return -EINTR;
+               }
 
                bch2_trans_unlock(trans);
                down_read(&c->gc_lock);
@@ -1584,6 +1586,8 @@ int bch2_btree_split_leaf(struct bch_fs *c, struct btree_iter *iter,
                        BUG_ON(flags & BTREE_INSERT_NOUNLOCK);
                        bch2_trans_unlock(trans);
                        ret = -EINTR;
+
+                       trace_transaction_restart_ip(trans->ip, _THIS_IP_);
                }
                goto out;
        }
index a9fcb54421867cc21ff8ac3b340eb1bccc720855..d109ef174fd02ca5bd650e9e57341526c4fced2c 100644 (file)
@@ -499,6 +499,23 @@ TRACE_EVENT(copygc,
                __entry->buckets_moved, __entry->buckets_not_moved)
 );
 
+TRACE_EVENT(transaction_restart_ip,
+       TP_PROTO(unsigned long caller, unsigned long ip),
+       TP_ARGS(caller, ip),
+
+       TP_STRUCT__entry(
+               __field(unsigned long,          caller  )
+               __field(unsigned long,          ip      )
+       ),
+
+       TP_fast_assign(
+               __entry->caller = caller;
+               __entry->ip     = ip;
+       ),
+
+       TP_printk("%pF %pF", (void *) __entry->caller, (void *) __entry->ip)
+);
+
 DECLARE_EVENT_CLASS(transaction_restart,
        TP_PROTO(unsigned long ip),
        TP_ARGS(ip),