1

bcachefs: Fix slow tracepoints

Some of our tracepoints were calling snprintf("pS") - which does symbol
table lookups - in TP_fast_assign(), which turns out to be a really bad
idea.

This was done because perf trace wasn't correctly printing tracepoints
that use %pS anymore - but it turns out trace-cmd does handle it
correctly.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
Kent Overstreet 2022-02-16 00:42:34 -05:00 committed by Kent Overstreet
parent eb331fe5a4
commit 4b59a319ad

View File

@ -358,7 +358,7 @@ TRACE_EVENT(btree_node_relock_fail,
TP_STRUCT__entry(
__array(char, trans_fn, 24 )
__array(char, caller, 32 )
__field(unsigned long, caller_ip )
__field(u8, btree_id )
__field(u64, pos_inode )
__field(u64, pos_offset )
@ -370,7 +370,7 @@ TRACE_EVENT(btree_node_relock_fail,
TP_fast_assign(
strncpy(__entry->trans_fn, trans_fn, sizeof(__entry->trans_fn));
snprintf(__entry->caller, sizeof(__entry->caller), "%pS", (void *) caller_ip);
__entry->caller_ip = caller_ip;
__entry->btree_id = btree_id;
__entry->pos_inode = pos->inode;
__entry->pos_offset = pos->offset;
@ -380,9 +380,9 @@ TRACE_EVENT(btree_node_relock_fail,
__entry->node_lock_seq = node_lock_seq;
),
TP_printk("%s %s btree %u pos %llu:%llu:%u, node %lu iter seq %u lock seq %u",
TP_printk("%s %pS btree %u pos %llu:%llu:%u, node %lu iter seq %u lock seq %u",
__entry->trans_fn,
__entry->caller,
(void *) __entry->caller_ip,
__entry->btree_id,
__entry->pos_inode,
__entry->pos_offset,
@ -673,7 +673,7 @@ DECLARE_EVENT_CLASS(transaction_restart_iter,
TP_STRUCT__entry(
__array(char, trans_fn, 24 )
__array(char, caller, 32 )
__field(unsigned long, caller_ip )
__field(u8, btree_id )
__field(u64, pos_inode )
__field(u64, pos_offset )
@ -682,16 +682,16 @@ DECLARE_EVENT_CLASS(transaction_restart_iter,
TP_fast_assign(
strncpy(__entry->trans_fn, trans_fn, sizeof(__entry->trans_fn));
snprintf(__entry->caller, sizeof(__entry->caller), "%pS", (void *) caller_ip);
__entry->caller_ip = caller_ip;
__entry->btree_id = btree_id;
__entry->pos_inode = pos->inode;
__entry->pos_offset = pos->offset;
__entry->pos_snapshot = pos->snapshot;
),
TP_printk("%s %s btree %u pos %llu:%llu:%u",
TP_printk("%s %pS btree %u pos %llu:%llu:%u",
__entry->trans_fn,
__entry->caller,
(void *) __entry->caller_ip,
__entry->btree_id,
__entry->pos_inode,
__entry->pos_offset,