bcachefs: Kill unused tracepoints
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 14 Jun 2025 00:06:33 +0000 (20:06 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 16 Jun 2025 23:03:52 +0000 (19:03 -0400)
Dead code cleanup.

Link: https://lore.kernel.org/linux-bcachefs/20250612224059.39fddd07@batman.local.home/
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_trans_commit.c
fs/bcachefs/btree_write_buffer.c
fs/bcachefs/errcode.h
fs/bcachefs/trace.h

index 61107f2310ab7de0cd9f6b0c18216f664fd3af91..639ef75b3dbd04dbbf2670fdb61015bd79c8e45c 100644 (file)
@@ -595,12 +595,13 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, unsigned flags,
        int ret = 0;
 
        bch2_trans_verify_not_unlocked_or_in_restart(trans);
-
+#if 0
+       /* todo: bring back dynamic fault injection */
        if (race_fault()) {
                trace_and_count(c, trans_restart_fault_inject, trans, trace_ip);
                return btree_trans_restart(trans, BCH_ERR_transaction_restart_fault_inject);
        }
-
+#endif
        /*
         * Check if the insert will fit in the leaf node with the write lock
         * held, otherwise another thread could write the node changing the
index 90b21e61d2b654a54cc9b8249ae4c166fdbaae3d..21b5c03d1822b8d6b36ddbd9a98867eefa23023f 100644 (file)
@@ -676,6 +676,9 @@ int bch2_btree_write_buffer_maybe_flush(struct btree_trans *trans,
                        goto err;
 
                bch2_bkey_buf_copy(last_flushed, c, tmp.k);
+
+               /* can we avoid the unconditional restart? */
+               trace_and_count(c, trans_restart_write_buffer_flush, trans, _RET_IP_);
                ret = bch_err_throw(c, transaction_restart_write_buffer_flush);
        }
 err:
index ac3264134a15a168090a651366e4ba4f43c5b2f6..86a842f1e88e69f67ef2a46b66431d0793ebfbf6 100644 (file)
        x(BCH_ERR_transaction_restart,  transaction_restart_relock)             \
        x(BCH_ERR_transaction_restart,  transaction_restart_relock_path)        \
        x(BCH_ERR_transaction_restart,  transaction_restart_relock_path_intent) \
-       x(BCH_ERR_transaction_restart,  transaction_restart_relock_after_fill)  \
        x(BCH_ERR_transaction_restart,  transaction_restart_too_many_iters)     \
        x(BCH_ERR_transaction_restart,  transaction_restart_lock_node_reused)   \
        x(BCH_ERR_transaction_restart,  transaction_restart_fill_relock)        \
        x(BCH_ERR_transaction_restart,  transaction_restart_would_deadlock_write)\
        x(BCH_ERR_transaction_restart,  transaction_restart_deadlock_recursion_limit)\
        x(BCH_ERR_transaction_restart,  transaction_restart_upgrade)            \
-       x(BCH_ERR_transaction_restart,  transaction_restart_key_cache_upgrade)  \
        x(BCH_ERR_transaction_restart,  transaction_restart_key_cache_fill)     \
        x(BCH_ERR_transaction_restart,  transaction_restart_key_cache_raced)    \
-       x(BCH_ERR_transaction_restart,  transaction_restart_key_cache_realloced)\
-       x(BCH_ERR_transaction_restart,  transaction_restart_journal_preres_get) \
        x(BCH_ERR_transaction_restart,  transaction_restart_split_race)         \
        x(BCH_ERR_transaction_restart,  transaction_restart_write_buffer_flush) \
        x(BCH_ERR_transaction_restart,  transaction_restart_nested)             \
        x(BCH_ERR_journal_res_blocked,  journal_buf_enomem)                     \
        x(BCH_ERR_journal_res_blocked,  journal_stuck)                          \
        x(BCH_ERR_journal_res_blocked,  journal_retry_open)                     \
-       x(BCH_ERR_journal_res_blocked,  journal_preres_get_blocked)             \
        x(BCH_ERR_journal_res_blocked,  bucket_alloc_blocked)                   \
        x(BCH_ERR_journal_res_blocked,  stripe_alloc_blocked)                   \
        x(BCH_ERR_invalid,              invalid_sb)                             \
index e759c9ff39658ac6135b8ca4ad99affa8b99c005..9c5a9c551f03d72aab8f8d7ee402c93af9c4b1ba 100644 (file)
@@ -1080,34 +1080,14 @@ TRACE_EVENT(trans_blocked_journal_reclaim,
                  __entry->must_wait)
 );
 
-TRACE_EVENT(trans_restart_journal_preres_get,
-       TP_PROTO(struct btree_trans *trans,
-                unsigned long caller_ip,
-                unsigned flags),
-       TP_ARGS(trans, caller_ip, flags),
-
-       TP_STRUCT__entry(
-               __array(char,                   trans_fn, 32    )
-               __field(unsigned long,          caller_ip       )
-               __field(unsigned,               flags           )
-       ),
-
-       TP_fast_assign(
-               strscpy(__entry->trans_fn, trans->fn, sizeof(__entry->trans_fn));
-               __entry->caller_ip              = caller_ip;
-               __entry->flags                  = flags;
-       ),
-
-       TP_printk("%s %pS %x", __entry->trans_fn,
-                 (void *) __entry->caller_ip,
-                 __entry->flags)
-);
-
+#if 0
+/* todo: bring back dynamic fault injection */
 DEFINE_EVENT(transaction_event,        trans_restart_fault_inject,
        TP_PROTO(struct btree_trans *trans,
                 unsigned long caller_ip),
        TP_ARGS(trans, caller_ip)
 );
+#endif
 
 DEFINE_EVENT(transaction_event,        trans_traverse_all,
        TP_PROTO(struct btree_trans *trans,
@@ -1195,19 +1175,6 @@ DEFINE_EVENT(transaction_restart_iter,   trans_restart_relock_parent_for_fill,
        TP_ARGS(trans, caller_ip, path)
 );
 
-DEFINE_EVENT(transaction_restart_iter, trans_restart_relock_after_fill,
-       TP_PROTO(struct btree_trans *trans,
-                unsigned long caller_ip,
-                struct btree_path *path),
-       TP_ARGS(trans, caller_ip, path)
-);
-
-DEFINE_EVENT(transaction_event,        trans_restart_key_cache_upgrade,
-       TP_PROTO(struct btree_trans *trans,
-                unsigned long caller_ip),
-       TP_ARGS(trans, caller_ip)
-);
-
 DEFINE_EVENT(transaction_restart_iter, trans_restart_relock_key_cache_fill,
        TP_PROTO(struct btree_trans *trans,
                 unsigned long caller_ip,
@@ -1229,13 +1196,6 @@ DEFINE_EVENT(transaction_restart_iter,   trans_restart_relock_path_intent,
        TP_ARGS(trans, caller_ip, path)
 );
 
-DEFINE_EVENT(transaction_restart_iter, trans_restart_traverse,
-       TP_PROTO(struct btree_trans *trans,
-                unsigned long caller_ip,
-                struct btree_path *path),
-       TP_ARGS(trans, caller_ip, path)
-);
-
 DEFINE_EVENT(transaction_restart_iter, trans_restart_memory_allocation_failure,
        TP_PROTO(struct btree_trans *trans,
                 unsigned long caller_ip,
@@ -1294,44 +1254,6 @@ TRACE_EVENT(trans_restart_mem_realloced,
                  __entry->bytes)
 );
 
-TRACE_EVENT(trans_restart_key_cache_key_realloced,
-       TP_PROTO(struct btree_trans *trans,
-                unsigned long caller_ip,
-                struct btree_path *path,
-                unsigned old_u64s,
-                unsigned new_u64s),
-       TP_ARGS(trans, caller_ip, path, old_u64s, new_u64s),
-
-       TP_STRUCT__entry(
-               __array(char,                   trans_fn, 32    )
-               __field(unsigned long,          caller_ip       )
-               __field(enum btree_id,          btree_id        )
-               TRACE_BPOS_entries(pos)
-               __field(u32,                    old_u64s        )
-               __field(u32,                    new_u64s        )
-       ),
-
-       TP_fast_assign(
-               strscpy(__entry->trans_fn, trans->fn, sizeof(__entry->trans_fn));
-               __entry->caller_ip              = caller_ip;
-
-               __entry->btree_id       = path->btree_id;
-               TRACE_BPOS_assign(pos, path->pos);
-               __entry->old_u64s       = old_u64s;
-               __entry->new_u64s       = new_u64s;
-       ),
-
-       TP_printk("%s %pS btree %s pos %llu:%llu:%u old_u64s %u new_u64s %u",
-                 __entry->trans_fn,
-                 (void *) __entry->caller_ip,
-                 bch2_btree_id_str(__entry->btree_id),
-                 __entry->pos_inode,
-                 __entry->pos_offset,
-                 __entry->pos_snapshot,
-                 __entry->old_u64s,
-                 __entry->new_u64s)
-);
-
 DEFINE_EVENT(transaction_event,        trans_restart_write_buffer_flush,
        TP_PROTO(struct btree_trans *trans,
                 unsigned long caller_ip),
@@ -1927,21 +1849,6 @@ TRACE_EVENT(btree_path_free,
                  __entry->dup_locked)
 );
 
-TRACE_EVENT(btree_path_free_trans_begin,
-       TP_PROTO(btree_path_idx_t path),
-       TP_ARGS(path),
-
-       TP_STRUCT__entry(
-               __field(btree_path_idx_t,       idx             )
-       ),
-
-       TP_fast_assign(
-               __entry->idx                    = path;
-       ),
-
-       TP_printk("   path %3u", __entry->idx)
-);
-
 #else /* CONFIG_BCACHEFS_PATH_TRACEPOINTS */
 #ifndef _TRACE_BCACHEFS_H
 
@@ -1959,7 +1866,6 @@ static inline void trace_btree_path_traverse_start(struct btree_trans *trans, st
 static inline void trace_btree_path_traverse_end(struct btree_trans *trans, struct btree_path *path) {}
 static inline void trace_btree_path_set_pos(struct btree_trans *trans, struct btree_path *path, struct bpos *new_pos) {}
 static inline void trace_btree_path_free(struct btree_trans *trans, btree_path_idx_t path, struct btree_path *dup) {}
-static inline void trace_btree_path_free_trans_begin(btree_path_idx_t path) {}
 
 #endif
 #endif /* CONFIG_BCACHEFS_PATH_TRACEPOINTS */