Commit 669f87a5 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Switch to __func__for recording where btree_trans was initialized

Symbol decoding, via %ps, isn't supported in userspace - this will also
be faster when we're using trans->fn in the fast path, as with the new
BCH_JSET_ENTRY_log journal messages.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent 98c80d6d
...@@ -857,7 +857,7 @@ struct btree *bch2_btree_node_get(struct btree_trans *trans, struct btree_path * ...@@ -857,7 +857,7 @@ struct btree *bch2_btree_node_get(struct btree_trans *trans, struct btree_path *
if (bch2_btree_node_relock(trans, path, level + 1)) if (bch2_btree_node_relock(trans, path, level + 1))
goto retry; goto retry;
trace_trans_restart_btree_node_reused(trans->ip, trace_trans_restart_btree_node_reused(trans->fn,
trace_ip, trace_ip,
path->btree_id, path->btree_id,
&path->pos); &path->pos);
......
...@@ -350,7 +350,7 @@ bool __bch2_btree_node_lock(struct btree_trans *trans, ...@@ -350,7 +350,7 @@ bool __bch2_btree_node_lock(struct btree_trans *trans,
} }
if (unlikely(deadlock_path)) { if (unlikely(deadlock_path)) {
trace_trans_restart_would_deadlock(trans->ip, ip, trace_trans_restart_would_deadlock(trans->fn, ip,
trans->in_traverse_all, reason, trans->in_traverse_all, reason,
deadlock_path->btree_id, deadlock_path->btree_id,
deadlock_path->cached, deadlock_path->cached,
...@@ -535,7 +535,7 @@ bool bch2_trans_relock(struct btree_trans *trans) ...@@ -535,7 +535,7 @@ bool bch2_trans_relock(struct btree_trans *trans)
trans_for_each_path(trans, path) trans_for_each_path(trans, path)
if (path->should_be_locked && if (path->should_be_locked &&
!bch2_btree_path_relock(trans, path, _RET_IP_)) { !bch2_btree_path_relock(trans, path, _RET_IP_)) {
trace_trans_restart_relock(trans->ip, _RET_IP_, trace_trans_restart_relock(trans->fn, _RET_IP_,
path->btree_id, &path->pos); path->btree_id, &path->pos);
BUG_ON(!trans->restarted); BUG_ON(!trans->restarted);
return false; return false;
...@@ -1505,7 +1505,9 @@ static int __btree_path_traverse_all(struct btree_trans *trans, int ret, ...@@ -1505,7 +1505,9 @@ static int __btree_path_traverse_all(struct btree_trans *trans, int ret,
out: out:
bch2_btree_cache_cannibalize_unlock(c); bch2_btree_cache_cannibalize_unlock(c);
trace_trans_traverse_all(trans->ip, trace_ip); trans->in_traverse_all = false;
trace_trans_traverse_all(trans->fn, trace_ip);
return ret; return ret;
} }
...@@ -2842,7 +2844,7 @@ void *bch2_trans_kmalloc(struct btree_trans *trans, size_t size) ...@@ -2842,7 +2844,7 @@ void *bch2_trans_kmalloc(struct btree_trans *trans, size_t size)
trans->mem_bytes = new_bytes; trans->mem_bytes = new_bytes;
if (old_bytes) { if (old_bytes) {
trace_trans_restart_mem_realloced(trans->ip, _RET_IP_, new_bytes); trace_trans_restart_mem_realloced(trans->fn, _RET_IP_, new_bytes);
btree_trans_restart(trans); btree_trans_restart(trans);
return ERR_PTR(-EINTR); return ERR_PTR(-EINTR);
} }
...@@ -2925,14 +2927,15 @@ static void bch2_trans_alloc_paths(struct btree_trans *trans, struct bch_fs *c) ...@@ -2925,14 +2927,15 @@ static void bch2_trans_alloc_paths(struct btree_trans *trans, struct bch_fs *c)
trans->updates = p; p += updates_bytes; trans->updates = p; p += updates_bytes;
} }
void bch2_trans_init(struct btree_trans *trans, struct bch_fs *c, void __bch2_trans_init(struct btree_trans *trans, struct bch_fs *c,
unsigned expected_nr_iters, unsigned expected_nr_iters,
size_t expected_mem_bytes) size_t expected_mem_bytes,
const char *fn)
__acquires(&c->btree_trans_barrier) __acquires(&c->btree_trans_barrier)
{ {
memset(trans, 0, sizeof(*trans)); memset(trans, 0, sizeof(*trans));
trans->c = c; trans->c = c;
trans->ip = _RET_IP_; trans->fn = fn;
trans->journal_replay_not_finished = trans->journal_replay_not_finished =
!test_bit(JOURNAL_REPLAY_DONE, &c->journal.flags); !test_bit(JOURNAL_REPLAY_DONE, &c->journal.flags);
...@@ -2971,7 +2974,7 @@ static void check_btree_paths_leaked(struct btree_trans *trans) ...@@ -2971,7 +2974,7 @@ static void check_btree_paths_leaked(struct btree_trans *trans)
goto leaked; goto leaked;
return; return;
leaked: leaked:
bch_err(c, "btree paths leaked from %pS!", (void *) trans->ip); bch_err(c, "btree paths leaked from %s!", trans->fn);
trans_for_each_path(trans, path) trans_for_each_path(trans, path)
if (path->ref) if (path->ref)
printk(KERN_ERR " btree %s %pS\n", printk(KERN_ERR " btree %s %pS\n",
...@@ -3069,7 +3072,7 @@ void bch2_btree_trans_to_text(struct printbuf *out, struct bch_fs *c) ...@@ -3069,7 +3072,7 @@ void bch2_btree_trans_to_text(struct printbuf *out, struct bch_fs *c)
if (!trans_has_locks(trans)) if (!trans_has_locks(trans))
continue; continue;
pr_buf(out, "%i %ps\n", trans->pid, (void *) trans->ip); pr_buf(out, "%i %s\n", trans->pid, trans->fn);
trans_for_each_path(trans, path) { trans_for_each_path(trans, path) {
if (!path->nodes_locked) if (!path->nodes_locked)
......
...@@ -379,9 +379,12 @@ __bch2_btree_iter_peek_and_restart(struct btree_trans *trans, ...@@ -379,9 +379,12 @@ __bch2_btree_iter_peek_and_restart(struct btree_trans *trans,
/* new multiple iterator interface: */ /* new multiple iterator interface: */
void bch2_dump_trans_paths_updates(struct btree_trans *); void bch2_dump_trans_paths_updates(struct btree_trans *);
void bch2_trans_init(struct btree_trans *, struct bch_fs *, unsigned, size_t); void __bch2_trans_init(struct btree_trans *, struct bch_fs *,
unsigned, size_t, const char *);
void bch2_trans_exit(struct btree_trans *); void bch2_trans_exit(struct btree_trans *);
#define bch2_trans_init(...) __bch2_trans_init(__VA_ARGS__, __func__)
void bch2_btree_trans_to_text(struct printbuf *, struct bch_fs *); void bch2_btree_trans_to_text(struct printbuf *, struct bch_fs *);
void bch2_fs_btree_iter_exit(struct bch_fs *); void bch2_fs_btree_iter_exit(struct bch_fs *);
......
...@@ -224,7 +224,7 @@ static int btree_key_cache_fill(struct btree_trans *trans, ...@@ -224,7 +224,7 @@ static int btree_key_cache_fill(struct btree_trans *trans,
goto err; goto err;
if (!bch2_btree_node_relock(trans, ck_path, 0)) { if (!bch2_btree_node_relock(trans, ck_path, 0)) {
trace_transaction_restart_ip(trans->ip, _THIS_IP_); trace_transaction_restart_ip(trans->fn, _THIS_IP_);
ret = btree_trans_restart(trans); ret = btree_trans_restart(trans);
goto err; goto err;
} }
...@@ -319,7 +319,7 @@ int bch2_btree_path_traverse_cached(struct btree_trans *trans, struct btree_path ...@@ -319,7 +319,7 @@ int bch2_btree_path_traverse_cached(struct btree_trans *trans, struct btree_path
if (!trans->restarted) if (!trans->restarted)
goto retry; goto retry;
trace_transaction_restart_ip(trans->ip, _THIS_IP_); trace_transaction_restart_ip(trans->fn, _THIS_IP_);
ret = -EINTR; ret = -EINTR;
goto err; goto err;
} }
...@@ -339,7 +339,7 @@ int bch2_btree_path_traverse_cached(struct btree_trans *trans, struct btree_path ...@@ -339,7 +339,7 @@ int bch2_btree_path_traverse_cached(struct btree_trans *trans, struct btree_path
if (!ck->valid && !(flags & BTREE_ITER_CACHED_NOFILL)) { if (!ck->valid && !(flags & BTREE_ITER_CACHED_NOFILL)) {
if (!path->locks_want && if (!path->locks_want &&
!__bch2_btree_path_upgrade(trans, path, 1)) { !__bch2_btree_path_upgrade(trans, path, 1)) {
trace_transaction_restart_ip(trans->ip, _THIS_IP_); trace_transaction_restart_ip(trans->fn, _THIS_IP_);
ret = btree_trans_restart(trans); ret = btree_trans_restart(trans);
goto err; goto err;
} }
......
...@@ -365,6 +365,7 @@ struct btree_trans_commit_hook { ...@@ -365,6 +365,7 @@ struct btree_trans_commit_hook {
struct btree_trans { struct btree_trans {
struct bch_fs *c; struct bch_fs *c;
const char *fn;
struct list_head list; struct list_head list;
struct btree *locking; struct btree *locking;
unsigned locking_path_idx; unsigned locking_path_idx;
...@@ -372,7 +373,6 @@ struct btree_trans { ...@@ -372,7 +373,6 @@ struct btree_trans {
u8 locking_btree_id; u8 locking_btree_id;
u8 locking_level; u8 locking_level;
pid_t pid; pid_t pid;
unsigned long ip;
int srcu_idx; int srcu_idx;
u8 nr_sorted; u8 nr_sorted;
......
...@@ -955,7 +955,7 @@ bch2_btree_update_start(struct btree_trans *trans, struct btree_path *path, ...@@ -955,7 +955,7 @@ bch2_btree_update_start(struct btree_trans *trans, struct btree_path *path,
* instead of locking/reserving all the way to the root: * instead of locking/reserving all the way to the root:
*/ */
if (!bch2_btree_path_upgrade(trans, path, U8_MAX)) { if (!bch2_btree_path_upgrade(trans, path, U8_MAX)) {
trace_trans_restart_iter_upgrade(trans->ip, _RET_IP_, trace_trans_restart_iter_upgrade(trans->fn, _RET_IP_,
path->btree_id, &path->pos); path->btree_id, &path->pos);
ret = btree_trans_restart(trans); ret = btree_trans_restart(trans);
return ERR_PTR(ret); return ERR_PTR(ret);
...@@ -1019,7 +1019,7 @@ bch2_btree_update_start(struct btree_trans *trans, struct btree_path *path, ...@@ -1019,7 +1019,7 @@ bch2_btree_update_start(struct btree_trans *trans, struct btree_path *path,
BTREE_UPDATE_JOURNAL_RES, BTREE_UPDATE_JOURNAL_RES,
journal_flags); journal_flags);
if (ret) { if (ret) {
trace_trans_restart_journal_preres_get(trans->ip, _RET_IP_); trace_trans_restart_journal_preres_get(trans->fn, _RET_IP_);
goto err; goto err;
} }
......
...@@ -266,7 +266,7 @@ bch2_trans_journal_preres_get_cold(struct btree_trans *trans, unsigned u64s, ...@@ -266,7 +266,7 @@ bch2_trans_journal_preres_get_cold(struct btree_trans *trans, unsigned u64s,
return ret; return ret;
if (!bch2_trans_relock(trans)) { if (!bch2_trans_relock(trans)) {
trace_trans_restart_journal_preres_get(trans->ip, trace_ip); trace_trans_restart_journal_preres_get(trans->fn, trace_ip);
return -EINTR; return -EINTR;
} }
...@@ -305,7 +305,8 @@ static noinline void journal_transaction_name(struct btree_trans *trans) ...@@ -305,7 +305,8 @@ static noinline void journal_transaction_name(struct btree_trans *trans)
l->entry.pad[0] = 0; l->entry.pad[0] = 0;
l->entry.pad[1] = 0; l->entry.pad[1] = 0;
l->entry.pad[2] = 0; l->entry.pad[2] = 0;
b = snprintf(l->d, buflen, "%ps", (void *) trans->ip); b = min_t(unsigned, strlen(trans->fn), buflen);
memcpy(l->d, trans->fn, b);
while (b < buflen) while (b < buflen)
l->d[b++] = '\0'; l->d[b++] = '\0';
...@@ -426,7 +427,7 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, ...@@ -426,7 +427,7 @@ bch2_trans_commit_write_locked(struct btree_trans *trans,
int ret; int ret;
if (race_fault()) { if (race_fault()) {
trace_trans_restart_fault_inject(trans->ip, trace_ip); trace_trans_restart_fault_inject(trans->fn, trace_ip);
trans->restarted = true; trans->restarted = true;
return -EINTR; return -EINTR;
} }
...@@ -619,7 +620,7 @@ static inline int trans_lock_write(struct btree_trans *trans) ...@@ -619,7 +620,7 @@ static inline int trans_lock_write(struct btree_trans *trans)
bch2_btree_node_unlock_write_inlined(trans, i->path, insert_l(i)->b); bch2_btree_node_unlock_write_inlined(trans, i->path, insert_l(i)->b);
} }
trace_trans_restart_would_deadlock_write(trans->ip); trace_trans_restart_would_deadlock_write(trans->fn);
return btree_trans_restart(trans); return btree_trans_restart(trans);
} }
...@@ -650,9 +651,8 @@ static inline int do_bch2_trans_commit(struct btree_trans *trans, ...@@ -650,9 +651,8 @@ static inline int do_bch2_trans_commit(struct btree_trans *trans,
char buf[200]; char buf[200];
bch2_bkey_val_to_text(&PBUF(buf), c, bkey_i_to_s_c(i->k)); bch2_bkey_val_to_text(&PBUF(buf), c, bkey_i_to_s_c(i->k));
bch_err(c, "invalid bkey %s on insert from %ps -> %ps: %s\n", bch_err(c, "invalid bkey %s on insert from %s -> %ps: %s\n",
buf, (void *) trans->ip, buf, trans->fn, (void *) i->ip_allocated, invalid);
(void *) i->ip_allocated, invalid);
bch2_fatal_error(c); bch2_fatal_error(c);
return -EINVAL; return -EINVAL;
} }
...@@ -758,7 +758,7 @@ int bch2_trans_commit_error(struct btree_trans *trans, ...@@ -758,7 +758,7 @@ int bch2_trans_commit_error(struct btree_trans *trans,
return 0; return 0;
if (ret == -EINTR) if (ret == -EINTR)
trace_trans_restart_btree_node_split(trans->ip, trace_ip, trace_trans_restart_btree_node_split(trans->fn, trace_ip,
i->btree_id, &i->path->pos); i->btree_id, &i->path->pos);
break; break;
case BTREE_INSERT_NEED_MARK_REPLICAS: case BTREE_INSERT_NEED_MARK_REPLICAS:
...@@ -771,7 +771,7 @@ int bch2_trans_commit_error(struct btree_trans *trans, ...@@ -771,7 +771,7 @@ int bch2_trans_commit_error(struct btree_trans *trans,
if (bch2_trans_relock(trans)) if (bch2_trans_relock(trans))
return 0; return 0;
trace_trans_restart_mark_replicas(trans->ip, trace_ip); trace_trans_restart_mark_replicas(trans->fn, trace_ip);
ret = -EINTR; ret = -EINTR;
break; break;
case BTREE_INSERT_NEED_JOURNAL_RES: case BTREE_INSERT_NEED_JOURNAL_RES:
...@@ -791,13 +791,13 @@ int bch2_trans_commit_error(struct btree_trans *trans, ...@@ -791,13 +791,13 @@ int bch2_trans_commit_error(struct btree_trans *trans,
if (bch2_trans_relock(trans)) if (bch2_trans_relock(trans))
return 0; return 0;
trace_trans_restart_journal_res_get(trans->ip, trace_ip); trace_trans_restart_journal_res_get(trans->fn, trace_ip);
ret = -EINTR; ret = -EINTR;
break; break;
case BTREE_INSERT_NEED_JOURNAL_RECLAIM: case BTREE_INSERT_NEED_JOURNAL_RECLAIM:
bch2_trans_unlock(trans); bch2_trans_unlock(trans);
trace_trans_blocked_journal_reclaim(trans->ip, trace_ip); trace_trans_blocked_journal_reclaim(trans->fn, trace_ip);
wait_event_freezable(c->journal.reclaim_wait, wait_event_freezable(c->journal.reclaim_wait,
(ret = journal_reclaim_wait_done(c))); (ret = journal_reclaim_wait_done(c)));
...@@ -807,7 +807,7 @@ int bch2_trans_commit_error(struct btree_trans *trans, ...@@ -807,7 +807,7 @@ int bch2_trans_commit_error(struct btree_trans *trans,
if (bch2_trans_relock(trans)) if (bch2_trans_relock(trans))
return 0; return 0;
trace_trans_restart_journal_reclaim(trans->ip, trace_ip); trace_trans_restart_journal_reclaim(trans->fn, trace_ip);
ret = -EINTR; ret = -EINTR;
break; break;
default: default:
...@@ -902,7 +902,7 @@ static int bch2_trans_commit_run_triggers(struct btree_trans *trans) ...@@ -902,7 +902,7 @@ static int bch2_trans_commit_run_triggers(struct btree_trans *trans)
} }
if (ret == -EINTR) if (ret == -EINTR)
trace_trans_restart_mark(trans->ip, _RET_IP_, trace_trans_restart_mark(trans->fn, _RET_IP_,
i->btree_id, &i->path->pos); i->btree_id, &i->path->pos);
if (ret) if (ret)
return ret; return ret;
...@@ -932,7 +932,7 @@ static int bch2_trans_commit_run_triggers(struct btree_trans *trans) ...@@ -932,7 +932,7 @@ static int bch2_trans_commit_run_triggers(struct btree_trans *trans)
BTREE_TRIGGER_OVERWRITE|i->flags); BTREE_TRIGGER_OVERWRITE|i->flags);
if (ret == -EINTR) if (ret == -EINTR)
trace_trans_restart_mark(trans->ip, _RET_IP_, trace_trans_restart_mark(trans->fn, _RET_IP_,
i->btree_id, &i->path->pos); i->btree_id, &i->path->pos);
if (ret) if (ret)
return ret; return ret;
...@@ -999,7 +999,7 @@ int __bch2_trans_commit(struct btree_trans *trans) ...@@ -999,7 +999,7 @@ int __bch2_trans_commit(struct btree_trans *trans)
BUG_ON(!i->path->should_be_locked); BUG_ON(!i->path->should_be_locked);
if (unlikely(!bch2_btree_path_upgrade(trans, i->path, i->level + 1))) { if (unlikely(!bch2_btree_path_upgrade(trans, i->path, i->level + 1))) {
trace_trans_restart_upgrade(trans->ip, _RET_IP_, trace_trans_restart_upgrade(trans->fn, _RET_IP_,
i->btree_id, &i->path->pos); i->btree_id, &i->path->pos);
ret = btree_trans_restart(trans); ret = btree_trans_restart(trans);
goto out; goto out;
......
...@@ -135,7 +135,6 @@ int __must_check bch2_write_inode(struct bch_fs *c, ...@@ -135,7 +135,6 @@ int __must_check bch2_write_inode(struct bch_fs *c,
int ret; int ret;
bch2_trans_init(&trans, c, 0, 512); bch2_trans_init(&trans, c, 0, 512);
trans.ip = _RET_IP_;
retry: retry:
bch2_trans_begin(&trans); bch2_trans_begin(&trans);
......
...@@ -546,94 +546,81 @@ TRACE_EVENT(copygc_wait, ...@@ -546,94 +546,81 @@ TRACE_EVENT(copygc_wait,
__entry->wait_amount, __entry->until) __entry->wait_amount, __entry->until)
); );
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("%pS %pS", (void *) __entry->caller, (void *) __entry->ip)
);
DECLARE_EVENT_CLASS(transaction_restart, DECLARE_EVENT_CLASS(transaction_restart,
TP_PROTO(unsigned long trans_ip, TP_PROTO(const char *trans_fn,
unsigned long caller_ip), unsigned long caller_ip),
TP_ARGS(trans_ip, caller_ip), TP_ARGS(trans_fn, caller_ip),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(unsigned long, trans_ip ) __array(char, trans_fn, 24 )
__field(unsigned long, caller_ip ) __field(unsigned long, caller_ip )
), ),
TP_fast_assign( TP_fast_assign(
__entry->trans_ip = trans_ip; strncpy(__entry->trans_fn, trans_fn, sizeof(__entry->trans_fn));
__entry->caller_ip = caller_ip; __entry->caller_ip = caller_ip;
), ),
TP_printk("%pS %pS", TP_printk("%s %pS", __entry->trans_fn, (void *) __entry->caller_ip)
(void *) __entry->trans_ip, );
(void *) __entry->caller_ip)
DEFINE_EVENT(transaction_restart, transaction_restart_ip,
TP_PROTO(const char *trans_fn,
unsigned long caller_ip),
TP_ARGS(trans_fn, caller_ip)
); );
DEFINE_EVENT(transaction_restart, trans_blocked_journal_reclaim, DEFINE_EVENT(transaction_restart, trans_blocked_journal_reclaim,
TP_PROTO(unsigned long trans_ip, TP_PROTO(const char *trans_fn,
unsigned long caller_ip), unsigned long caller_ip),
TP_ARGS(trans_ip, caller_ip) TP_ARGS(trans_fn, caller_ip)
); );
DEFINE_EVENT(transaction_restart, trans_restart_journal_res_get, DEFINE_EVENT(transaction_restart, trans_restart_journal_res_get,
TP_PROTO(unsigned long trans_ip, TP_PROTO(const char *trans_fn,
unsigned long caller_ip), unsigned long caller_ip),
TP_ARGS(trans_ip, caller_ip) TP_ARGS(trans_fn, caller_ip)
); );
DEFINE_EVENT(transaction_restart, trans_restart_journal_preres_get, DEFINE_EVENT(transaction_restart, trans_restart_journal_preres_get,
TP_PROTO(unsigned long trans_ip, TP_PROTO(const char *trans_fn,
unsigned long caller_ip), unsigned long caller_ip),
TP_ARGS(trans_ip, caller_ip) TP_ARGS(trans_fn, caller_ip)
); );
DEFINE_EVENT(transaction_restart, trans_restart_journal_reclaim, DEFINE_EVENT(transaction_restart, trans_restart_journal_reclaim,
TP_PROTO(unsigned long trans_ip, TP_PROTO(const char *trans_fn,
unsigned long caller_ip), unsigned long caller_ip),
TP_ARGS(trans_ip, caller_ip) TP_ARGS(trans_fn, caller_ip)
); );
DEFINE_EVENT(transaction_restart, trans_restart_fault_inject, DEFINE_EVENT(transaction_restart, trans_restart_fault_inject,
TP_PROTO(unsigned long trans_ip, TP_PROTO(const char *trans_fn,
unsigned long caller_ip), unsigned long caller_ip),
TP_ARGS(trans_ip, caller_ip) TP_ARGS(trans_fn, caller_ip)
); );
DEFINE_EVENT(transaction_restart, trans_traverse_all, DEFINE_EVENT(transaction_restart, trans_traverse_all,
TP_PROTO(unsigned long trans_ip, TP_PROTO(const char *trans_fn,
unsigned long caller_ip), unsigned long caller_ip),
TP_ARGS(trans_ip, caller_ip) TP_ARGS(trans_fn, caller_ip)
); );
DEFINE_EVENT(transaction_restart, trans_restart_mark_replicas, DEFINE_EVENT(transaction_restart, trans_restart_mark_replicas,
TP_PROTO(unsigned long trans_ip, TP_PROTO(const char *trans_fn,
unsigned long caller_ip), unsigned long caller_ip),
TP_ARGS(trans_ip, caller_ip) TP_ARGS(trans_fn, caller_ip)
); );
DECLARE_EVENT_CLASS(transaction_restart_iter, DECLARE_EVENT_CLASS(transaction_restart_iter,
TP_PROTO(unsigned long trans_ip, TP_PROTO(const char *trans_fn,
unsigned long caller_ip, unsigned long caller_ip,
enum btree_id btree_id, enum btree_id btree_id,
struct bpos *pos), struct bpos *pos),
TP_ARGS(trans_ip, caller_ip, btree_id, pos), TP_ARGS(trans_fn, caller_ip, btree_id, pos),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(unsigned long, trans_ip ) __array(char, trans_fn, 24 )
__field(unsigned long, caller_ip ) __field(unsigned long, caller_ip )
__field(u8, btree_id ) __field(u8, btree_id )
__field(u64, pos_inode ) __field(u64, pos_inode )
...@@ -642,7 +629,7 @@ DECLARE_EVENT_CLASS(transaction_restart_iter, ...@@ -642,7 +629,7 @@ DECLARE_EVENT_CLASS(transaction_restart_iter,
), ),
TP_fast_assign( TP_fast_assign(
__entry->trans_ip = trans_ip; strncpy(__entry->trans_fn, trans_fn, sizeof(__entry->trans_fn));
__entry->caller_ip = caller_ip; __entry->caller_ip = caller_ip;
__entry->btree_id = btree_id; __entry->btree_id = btree_id;
__entry->pos_inode = pos->inode; __entry->pos_inode = pos->inode;
...@@ -650,8 +637,8 @@ DECLARE_EVENT_CLASS(transaction_restart_iter, ...@@ -650,8 +637,8 @@ DECLARE_EVENT_CLASS(transaction_restart_iter,
__entry->pos_snapshot = pos->snapshot; __entry->pos_snapshot = pos->snapshot;
), ),
TP_printk("%ps %pS btree %u pos %llu:%llu:%u", TP_printk("%s %pS btree %u pos %llu:%llu:%u",
(void *) __entry->trans_ip, __entry->trans_fn,
(void *) __entry->caller_ip, (void *) __entry->caller_ip,
__entry->btree_id, __entry->btree_id,
__entry->pos_inode, __entry->pos_inode,
...@@ -660,63 +647,63 @@ DECLARE_EVENT_CLASS(transaction_restart_iter, ...@@ -660,63 +647,63 @@ DECLARE_EVENT_CLASS(transaction_restart_iter,
); );
DEFINE_EVENT(transaction_restart_iter, trans_restart_btree_node_reused, DEFINE_EVENT(transaction_restart_iter, trans_restart_btree_node_reused,
TP_PROTO(unsigned long trans_ip, TP_PROTO(const char *trans_fn,
unsigned long caller_ip, unsigned long caller_ip,
enum btree_id btree_id, enum btree_id btree_id,
struct bpos *pos), struct bpos *pos),
TP_ARGS(trans_ip, caller_ip, btree_id, pos) TP_ARGS(trans_fn, caller_ip, btree_id, pos)
); );
DEFINE_EVENT(transaction_restart_iter, trans_restart_btree_node_split, DEFINE_EVENT(transaction_restart_iter, trans_restart_btree_node_split,
TP_PROTO(unsigned long trans_ip, TP_PROTO(const char *trans_fn,
unsigned long caller_ip, unsigned long caller_ip,
enum btree_id btree_id, enum btree_id btree_id,
struct bpos *pos), struct bpos *pos),
TP_ARGS(trans_ip, caller_ip, btree_id, pos) TP_ARGS(trans_fn, caller_ip, btree_id, pos)
); );
DEFINE_EVENT(transaction_restart_iter, trans_restart_mark, DEFINE_EVENT(transaction_restart_iter, trans_restart_mark,
TP_PROTO(unsigned long trans_ip, TP_PROTO(const char *trans_fn,
unsigned long caller_ip, unsigned long caller_ip,
enum btree_id btree_id, enum btree_id btree_id,
struct bpos *pos), struct bpos *pos),
TP_ARGS(trans_ip, caller_ip, btree_id, pos) TP_ARGS(trans_fn, caller_ip, btree_id, pos)
); );
DEFINE_EVENT(transaction_restart_iter, trans_restart_upgrade, DEFINE_EVENT(transaction_restart_iter, trans_restart_upgrade,
TP_PROTO(unsigned long trans_ip, TP_PROTO(const char *trans_fn,
unsigned long caller_ip, unsigned long caller_ip,
enum btree_id btree_id, enum btree_id btree_id,
struct bpos *pos), struct bpos *pos),
TP_ARGS(trans_ip, caller_ip, btree_id, pos) TP_ARGS(trans_fn, caller_ip, btree_id, pos)
); );
DEFINE_EVENT(transaction_restart_iter, trans_restart_iter_upgrade, DEFINE_EVENT(transaction_restart_iter, trans_restart_iter_upgrade,
TP_PROTO(unsigned long trans_ip, TP_PROTO(const char *trans_fn,
unsigned long caller_ip, unsigned long caller_ip,
enum btree_id btree_id, enum btree_id btree_id,
struct bpos *pos), struct bpos *pos),
TP_ARGS(trans_ip, caller_ip, btree_id, pos) TP_ARGS(trans_fn, caller_ip, btree_id, pos)
); );
DEFINE_EVENT(transaction_restart_iter, trans_restart_relock, DEFINE_EVENT(transaction_restart_iter, trans_restart_relock,
TP_PROTO(unsigned long trans_ip, TP_PROTO(const char *trans_fn,
unsigned long caller_ip, unsigned long caller_ip,
enum btree_id btree_id, enum btree_id btree_id,
struct bpos *pos), struct bpos *pos),
TP_ARGS(trans_ip, caller_ip, btree_id, pos) TP_ARGS(trans_fn, caller_ip, btree_id, pos)
); );
DEFINE_EVENT(transaction_restart_iter, trans_restart_traverse, DEFINE_EVENT(transaction_restart_iter, trans_restart_traverse,
TP_PROTO(unsigned long trans_ip, TP_PROTO(const char *trans_fn,
unsigned long caller_ip, unsigned long caller_ip,
enum btree_id btree_id, enum btree_id btree_id,
struct bpos *pos), struct bpos *pos),
TP_ARGS(trans_ip, caller_ip, btree_id, pos) TP_ARGS(trans_fn, caller_ip, btree_id, pos)
); );
TRACE_EVENT(trans_restart_would_deadlock, TRACE_EVENT(trans_restart_would_deadlock,
TP_PROTO(unsigned long trans_ip, TP_PROTO(const char *trans_fn,
unsigned long caller_ip, unsigned long caller_ip,
bool in_traverse_all, bool in_traverse_all,
unsigned reason, unsigned reason,
...@@ -726,12 +713,12 @@ TRACE_EVENT(trans_restart_would_deadlock, ...@@ -726,12 +713,12 @@ TRACE_EVENT(trans_restart_would_deadlock,
enum btree_id want_btree_id, enum btree_id want_btree_id,
unsigned want_iter_type, unsigned want_iter_type,
struct bpos *want_pos), struct bpos *want_pos),
TP_ARGS(trans_ip, caller_ip, in_traverse_all, reason, TP_ARGS(trans_fn, caller_ip, in_traverse_all, reason,
have_btree_id, have_iter_type, have_pos, have_btree_id, have_iter_type, have_pos,
want_btree_id, want_iter_type, want_pos), want_btree_id, want_iter_type, want_pos),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(unsigned long, trans_ip ) __array(char, trans_fn, 24 )
__field(unsigned long, caller_ip ) __field(unsigned long, caller_ip )
__field(u8, in_traverse_all ) __field(u8, in_traverse_all )
__field(u8, reason ) __field(u8, reason )
...@@ -749,7 +736,7 @@ TRACE_EVENT(trans_restart_would_deadlock, ...@@ -749,7 +736,7 @@ TRACE_EVENT(trans_restart_would_deadlock,
), ),
TP_fast_assign( TP_fast_assign(
__entry->trans_ip = trans_ip; strncpy(__entry->trans_fn, trans_fn, sizeof(__entry->trans_fn));
__entry->caller_ip = caller_ip; __entry->caller_ip = caller_ip;
__entry->in_traverse_all = in_traverse_all; __entry->in_traverse_all = in_traverse_all;
__entry->reason = reason; __entry->reason = reason;
...@@ -767,8 +754,8 @@ TRACE_EVENT(trans_restart_would_deadlock, ...@@ -767,8 +754,8 @@ TRACE_EVENT(trans_restart_would_deadlock,
__entry->want_pos_snapshot = want_pos->snapshot; __entry->want_pos_snapshot = want_pos->snapshot;
), ),
TP_printk("%pS %pS traverse_all %u because %u have %u:%u %llu:%llu:%u want %u:%u %llu:%llu:%u", TP_printk("%s %pS traverse_all %u because %u have %u:%u %llu:%llu:%u want %u:%u %llu:%llu:%u",
(void *) __entry->trans_ip, __entry->trans_fn,
(void *) __entry->caller_ip, (void *) __entry->caller_ip,
__entry->in_traverse_all, __entry->in_traverse_all,
__entry->reason, __entry->reason,
...@@ -785,39 +772,40 @@ TRACE_EVENT(trans_restart_would_deadlock, ...@@ -785,39 +772,40 @@ TRACE_EVENT(trans_restart_would_deadlock,
); );
TRACE_EVENT(trans_restart_would_deadlock_write, TRACE_EVENT(trans_restart_would_deadlock_write,
TP_PROTO(unsigned long trans_ip), TP_PROTO(const char *trans_fn),
TP_ARGS(trans_ip), TP_ARGS(trans_fn),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(unsigned long, trans_ip ) __array(char, trans_fn, 24 )
), ),
TP_fast_assign( TP_fast_assign(
__entry->trans_ip = trans_ip; strncpy(__entry->trans_fn, trans_fn, sizeof(__entry->trans_fn));
), ),
TP_printk("%ps", (void *) __entry->trans_ip) TP_printk("%s", __entry->trans_fn)
); );
TRACE_EVENT(trans_restart_mem_realloced, TRACE_EVENT(trans_restart_mem_realloced,
TP_PROTO(unsigned long trans_ip, unsigned long caller_ip, TP_PROTO(const char *trans_fn,
unsigned long caller_ip,
unsigned long bytes), unsigned long bytes),
TP_ARGS(trans_ip, caller_ip, bytes), TP_ARGS(trans_fn, caller_ip, bytes),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(unsigned long, trans_ip ) __array(char, trans_fn, 24 )
__field(unsigned long, caller_ip ) __field(unsigned long, caller_ip )
__field(unsigned long, bytes ) __field(unsigned long, bytes )
), ),
TP_fast_assign( TP_fast_assign(
__entry->trans_ip = trans_ip; strncpy(__entry->trans_fn, trans_fn, sizeof(__entry->trans_fn));
__entry->caller_ip = caller_ip; __entry->caller_ip = caller_ip;
__entry->bytes = bytes; __entry->bytes = bytes;
), ),
TP_printk("%pS %pS bytes %lu", TP_printk("%s %pS bytes %lu",
(void *) __entry->trans_ip, __entry->trans_fn,
(void *) __entry->caller_ip, (void *) __entry->caller_ip,
__entry->bytes) __entry->bytes)
); );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment