Commit 9f96568c authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Tracepoint improvements

Our types are exported to the tracepoint code, so it's not necessary to
break things out individually when passing them to tracepoints - we can
also call other functions from TP_fast_assign().
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent c7be3cb5
...@@ -691,8 +691,7 @@ static noinline struct btree *bch2_btree_node_fill(struct bch_fs *c, ...@@ -691,8 +691,7 @@ static noinline struct btree *bch2_btree_node_fill(struct bch_fs *c,
* been freed: * been freed:
*/ */
if (trans && !bch2_btree_node_relock(trans, path, level + 1)) { if (trans && !bch2_btree_node_relock(trans, path, level + 1)) {
trace_trans_restart_relock_parent_for_fill(trans->fn, trace_trans_restart_relock_parent_for_fill(trans, _THIS_IP_, path);
_THIS_IP_, btree_id, &path->pos);
return ERR_PTR(btree_trans_restart(trans, BCH_ERR_transaction_restart_fill_relock)); return ERR_PTR(btree_trans_restart(trans, BCH_ERR_transaction_restart_fill_relock));
} }
...@@ -700,9 +699,7 @@ static noinline struct btree *bch2_btree_node_fill(struct bch_fs *c, ...@@ -700,9 +699,7 @@ static noinline struct btree *bch2_btree_node_fill(struct bch_fs *c,
if (trans && b == ERR_PTR(-ENOMEM)) { if (trans && b == ERR_PTR(-ENOMEM)) {
trans->memory_allocation_failure = true; trans->memory_allocation_failure = true;
trace_trans_restart_memory_allocation_failure(trans->fn, trace_trans_restart_memory_allocation_failure(trans, _THIS_IP_, path);
_THIS_IP_, btree_id, &path->pos);
return ERR_PTR(btree_trans_restart(trans, BCH_ERR_transaction_restart_fill_mem_alloc_fail)); return ERR_PTR(btree_trans_restart(trans, BCH_ERR_transaction_restart_fill_mem_alloc_fail));
} }
...@@ -750,8 +747,8 @@ static noinline struct btree *bch2_btree_node_fill(struct bch_fs *c, ...@@ -750,8 +747,8 @@ static noinline struct btree *bch2_btree_node_fill(struct bch_fs *c,
} }
if (!six_relock_type(&b->c.lock, lock_type, seq)) { if (!six_relock_type(&b->c.lock, lock_type, seq)) {
trace_trans_restart_relock_after_fill(trans->fn, _THIS_IP_, if (trans)
btree_id, &path->pos); trace_trans_restart_relock_after_fill(trans, _THIS_IP_, path);
return ERR_PTR(btree_trans_restart(trans, BCH_ERR_transaction_restart_relock_after_fill)); return ERR_PTR(btree_trans_restart(trans, BCH_ERR_transaction_restart_relock_after_fill));
} }
...@@ -906,10 +903,7 @@ struct btree *bch2_btree_node_get(struct btree_trans *trans, struct btree_path * ...@@ -906,10 +903,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->fn, trace_trans_restart_btree_node_reused(trans, trace_ip, path);
trace_ip,
path->btree_id,
&path->pos);
return ERR_PTR(btree_trans_restart(trans, BCH_ERR_transaction_restart_lock_node_reused)); return ERR_PTR(btree_trans_restart(trans, BCH_ERR_transaction_restart_lock_node_reused));
} }
} }
......
...@@ -88,11 +88,6 @@ static inline struct bpos bkey_predecessor(struct btree_iter *iter, struct bpos ...@@ -88,11 +88,6 @@ static inline struct bpos bkey_predecessor(struct btree_iter *iter, struct bpos
return p; return p;
} }
static inline bool is_btree_node(struct btree_path *path, unsigned l)
{
return l < BTREE_MAX_DEPTH && !IS_ERR_OR_NULL(path->l[l].b);
}
static inline struct bpos btree_iter_search_key(struct btree_iter *iter) static inline struct bpos btree_iter_search_key(struct btree_iter *iter)
{ {
struct bpos pos = iter->pos; struct bpos pos = iter->pos;
...@@ -195,12 +190,7 @@ bool __bch2_btree_node_relock(struct btree_trans *trans, ...@@ -195,12 +190,7 @@ bool __bch2_btree_node_relock(struct btree_trans *trans,
fail: fail:
if (b != ERR_PTR(-BCH_ERR_no_btree_node_cached) && if (b != ERR_PTR(-BCH_ERR_no_btree_node_cached) &&
b != ERR_PTR(-BCH_ERR_no_btree_node_init)) b != ERR_PTR(-BCH_ERR_no_btree_node_init))
trace_btree_node_relock_fail(trans->fn, _RET_IP_, trace_btree_node_relock_fail(trans, _RET_IP_, path, level);
path->btree_id,
&path->pos,
(unsigned long) b,
path->l[level].lock_seq,
is_btree_node(path, level) ? b->c.lock.state.seq : 0);
return false; return false;
} }
...@@ -240,12 +230,7 @@ bool bch2_btree_node_upgrade(struct btree_trans *trans, ...@@ -240,12 +230,7 @@ bool bch2_btree_node_upgrade(struct btree_trans *trans,
goto success; goto success;
} }
trace_btree_node_upgrade_fail(trans->fn, _RET_IP_, trace_btree_node_upgrade_fail(trans, _RET_IP_, path, level);
path->btree_id,
&path->pos,
btree_node_locked(path, level),
bch2_btree_node_lock_counts(trans, NULL, b, level),
six_lock_counts(&b->c.lock));
return false; return false;
success: success:
mark_btree_node_intent_locked(trans, path, level); mark_btree_node_intent_locked(trans, path, level);
...@@ -381,14 +366,7 @@ int __bch2_btree_node_lock(struct btree_trans *trans, ...@@ -381,14 +366,7 @@ int __bch2_btree_node_lock(struct btree_trans *trans,
return btree_node_lock_type(trans, path, b, pos, level, return btree_node_lock_type(trans, path, b, pos, level,
type, should_sleep_fn, p); type, should_sleep_fn, p);
deadlock: deadlock:
trace_trans_restart_would_deadlock(trans->fn, ip, trace_trans_restart_would_deadlock(trans, ip, reason, linked, path, &pos);
trans->in_traverse_all, reason,
linked->btree_id,
linked->cached,
&linked->pos,
path->btree_id,
path->cached,
&pos);
return btree_trans_restart(trans, BCH_ERR_transaction_restart_would_deadlock); return btree_trans_restart(trans, BCH_ERR_transaction_restart_would_deadlock);
} }
...@@ -438,8 +416,7 @@ int bch2_btree_path_relock_intent(struct btree_trans *trans, ...@@ -438,8 +416,7 @@ int bch2_btree_path_relock_intent(struct btree_trans *trans,
if (!bch2_btree_node_relock(trans, path, l)) { if (!bch2_btree_node_relock(trans, path, l)) {
__bch2_btree_path_unlock(trans, path); __bch2_btree_path_unlock(trans, path);
btree_path_set_dirty(path, BTREE_ITER_NEED_TRAVERSE); btree_path_set_dirty(path, BTREE_ITER_NEED_TRAVERSE);
trace_trans_restart_relock_path_intent(trans->fn, _RET_IP_, trace_trans_restart_relock_path_intent(trans, _RET_IP_, path);
path->btree_id, &path->pos);
return btree_trans_restart(trans, BCH_ERR_transaction_restart_relock_path_intent); return btree_trans_restart(trans, BCH_ERR_transaction_restart_relock_path_intent);
} }
} }
...@@ -454,8 +431,7 @@ static int __bch2_btree_path_relock(struct btree_trans *trans, ...@@ -454,8 +431,7 @@ static int __bch2_btree_path_relock(struct btree_trans *trans,
bool ret = btree_path_get_locks(trans, path, false); bool ret = btree_path_get_locks(trans, path, false);
if (!ret) { if (!ret) {
trace_trans_restart_relock_path(trans->fn, trace_ip, trace_trans_restart_relock_path(trans, trace_ip, path);
path->btree_id, &path->pos);
return btree_trans_restart(trans, BCH_ERR_transaction_restart_relock_path); return btree_trans_restart(trans, BCH_ERR_transaction_restart_relock_path);
} }
...@@ -561,8 +537,7 @@ int bch2_trans_relock(struct btree_trans *trans) ...@@ -561,8 +537,7 @@ int 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->fn, _RET_IP_, trace_trans_restart_relock(trans, _RET_IP_, path);
path->btree_id, &path->pos);
BUG_ON(!trans->restarted); BUG_ON(!trans->restarted);
return -BCH_ERR_transaction_restart_relock; return -BCH_ERR_transaction_restart_relock;
} }
...@@ -1529,7 +1504,7 @@ static int bch2_btree_path_traverse_all(struct btree_trans *trans) ...@@ -1529,7 +1504,7 @@ static int bch2_btree_path_traverse_all(struct btree_trans *trans)
trans->in_traverse_all = false; trans->in_traverse_all = false;
trace_trans_traverse_all(trans->fn, trace_ip); trace_trans_traverse_all(trans, trace_ip);
return ret; return ret;
} }
...@@ -1666,7 +1641,7 @@ int __must_check bch2_btree_path_traverse(struct btree_trans *trans, ...@@ -1666,7 +1641,7 @@ int __must_check bch2_btree_path_traverse(struct btree_trans *trans,
u64 max = ~(~0ULL << restart_probability_bits); u64 max = ~(~0ULL << restart_probability_bits);
if (!get_random_u32_below(max)) { if (!get_random_u32_below(max)) {
trace_transaction_restart_injected(trans->fn, _RET_IP_); trace_transaction_restart_injected(trans, _RET_IP_);
return btree_trans_restart(trans, BCH_ERR_transaction_restart_fault_inject); return btree_trans_restart(trans, BCH_ERR_transaction_restart_fault_inject);
} }
} }
...@@ -1798,7 +1773,6 @@ static struct btree_path *have_node_at_pos(struct btree_trans *trans, struct btr ...@@ -1798,7 +1773,6 @@ static struct btree_path *have_node_at_pos(struct btree_trans *trans, struct btr
static inline void __bch2_path_free(struct btree_trans *trans, struct btree_path *path) static inline void __bch2_path_free(struct btree_trans *trans, struct btree_path *path)
{ {
trace_btree_path_free(trans->fn, _RET_IP_, path->btree_id, &path->pos);
__bch2_btree_path_unlock(trans, path); __bch2_btree_path_unlock(trans, path);
btree_path_list_remove(trans, path); btree_path_list_remove(trans, path);
trans->paths_allocated &= ~(1ULL << path->idx); trans->paths_allocated &= ~(1ULL << path->idx);
...@@ -1891,10 +1865,10 @@ void bch2_dump_trans_paths_updates(struct btree_trans *trans) ...@@ -1891,10 +1865,10 @@ void bch2_dump_trans_paths_updates(struct btree_trans *trans)
bch2_bpos_to_text(&buf, path->pos); bch2_bpos_to_text(&buf, path->pos);
printk(KERN_ERR "path: idx %u ref %u:%u%s%s btree=%s l=%u pos %s locks %u %pS\n", printk(KERN_ERR "path: idx %2u ref %u:%u %c %c btree=%s l=%u pos %s locks %u %pS\n",
path->idx, path->ref, path->intent_ref, path->idx, path->ref, path->intent_ref,
path->should_be_locked ? " S" : "", path->preserve ? 'P' : ' ',
path->preserve ? " P" : "", path->should_be_locked ? 'S' : ' ',
bch2_btree_ids[path->btree_id], bch2_btree_ids[path->btree_id],
path->level, path->level,
buf.buf, buf.buf,
...@@ -1974,8 +1948,6 @@ struct btree_path *bch2_path_get(struct btree_trans *trans, ...@@ -1974,8 +1948,6 @@ struct btree_path *bch2_path_get(struct btree_trans *trans,
__btree_path_get(path_pos, intent); __btree_path_get(path_pos, intent);
path = bch2_btree_path_set_pos(trans, path_pos, pos, intent); path = bch2_btree_path_set_pos(trans, path_pos, pos, intent);
} else { } else {
trace_btree_path_alloc(trans->fn, _RET_IP_, btree_id, &pos, locks_want);
path = btree_path_alloc(trans, path_pos); path = btree_path_alloc(trans, path_pos);
path_pos = NULL; path_pos = NULL;
...@@ -2150,8 +2122,7 @@ struct btree *bch2_btree_iter_next_node(struct btree_iter *iter) ...@@ -2150,8 +2122,7 @@ struct btree *bch2_btree_iter_next_node(struct btree_iter *iter)
path->l[path->level].b = ERR_PTR(-BCH_ERR_no_btree_node_relock); path->l[path->level].b = ERR_PTR(-BCH_ERR_no_btree_node_relock);
path->l[path->level + 1].b = ERR_PTR(-BCH_ERR_no_btree_node_relock); path->l[path->level + 1].b = ERR_PTR(-BCH_ERR_no_btree_node_relock);
btree_path_set_dirty(path, BTREE_ITER_NEED_TRAVERSE); btree_path_set_dirty(path, BTREE_ITER_NEED_TRAVERSE);
trace_trans_restart_relock_next_node(trans->fn, _THIS_IP_, trace_trans_restart_relock_next_node(trans, _THIS_IP_, path);
path->btree_id, &path->pos);
ret = btree_trans_restart(trans, BCH_ERR_transaction_restart_relock); ret = btree_trans_restart(trans, BCH_ERR_transaction_restart_relock);
goto err; goto err;
} }
...@@ -3185,7 +3156,7 @@ void *bch2_trans_kmalloc(struct btree_trans *trans, size_t size) ...@@ -3185,7 +3156,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->fn, _RET_IP_, new_bytes); trace_trans_restart_mem_realloced(trans, _RET_IP_, new_bytes);
return ERR_PTR(btree_trans_restart(trans, BCH_ERR_transaction_restart_mem_realloced)); return ERR_PTR(btree_trans_restart(trans, BCH_ERR_transaction_restart_mem_realloced));
} }
} }
......
...@@ -405,7 +405,7 @@ static inline struct bkey_s_c bch2_btree_iter_peek_upto_type(struct btree_iter * ...@@ -405,7 +405,7 @@ static inline struct bkey_s_c bch2_btree_iter_peek_upto_type(struct btree_iter *
static inline int btree_trans_too_many_iters(struct btree_trans *trans) static inline int btree_trans_too_many_iters(struct btree_trans *trans)
{ {
if (hweight64(trans->paths_allocated) > BTREE_ITER_MAX / 2) { if (hweight64(trans->paths_allocated) > BTREE_ITER_MAX / 2) {
trace_trans_restart_too_many_iters(trans->fn, _THIS_IP_); trace_trans_restart_too_many_iters(trans, _THIS_IP_);
return btree_trans_restart(trans, BCH_ERR_transaction_restart_too_many_iters); return btree_trans_restart(trans, BCH_ERR_transaction_restart_too_many_iters);
} }
......
...@@ -291,8 +291,7 @@ static int btree_key_cache_fill(struct btree_trans *trans, ...@@ -291,8 +291,7 @@ static int btree_key_cache_fill(struct btree_trans *trans,
k = bch2_btree_path_peek_slot(path, &u); k = bch2_btree_path_peek_slot(path, &u);
if (!bch2_btree_node_relock(trans, ck_path, 0)) { if (!bch2_btree_node_relock(trans, ck_path, 0)) {
trace_trans_restart_relock_key_cache_fill(trans->fn, trace_trans_restart_relock_key_cache_fill(trans, _THIS_IP_, ck_path);
_THIS_IP_, ck_path->btree_id, &ck_path->pos);
ret = btree_trans_restart(trans, BCH_ERR_transaction_restart_key_cache_raced); ret = btree_trans_restart(trans, BCH_ERR_transaction_restart_key_cache_raced);
goto err; goto err;
} }
...@@ -420,7 +419,7 @@ int bch2_btree_path_traverse_cached(struct btree_trans *trans, struct btree_path ...@@ -420,7 +419,7 @@ int bch2_btree_path_traverse_cached(struct btree_trans *trans, struct btree_path
*/ */
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_key_cache_upgrade(trans->fn, _THIS_IP_); trace_transaction_restart_key_cache_upgrade(trans, _THIS_IP_);
ret = btree_trans_restart(trans, BCH_ERR_transaction_restart_key_cache_upgrade); ret = btree_trans_restart(trans, BCH_ERR_transaction_restart_key_cache_upgrade);
goto err; goto err;
} }
......
...@@ -13,6 +13,11 @@ ...@@ -13,6 +13,11 @@
#include "btree_iter.h" #include "btree_iter.h"
#include "six.h" #include "six.h"
static inline bool is_btree_node(struct btree_path *path, unsigned l)
{
return l < BTREE_MAX_DEPTH && !IS_ERR_OR_NULL(path->l[l].b);
}
/* matches six lock types */ /* matches six lock types */
enum btree_node_locked_type { enum btree_node_locked_type {
BTREE_NODE_UNLOCKED = -1, BTREE_NODE_UNLOCKED = -1,
...@@ -306,4 +311,7 @@ static inline void btree_path_set_level_up(struct btree_trans *trans, ...@@ -306,4 +311,7 @@ static inline void btree_path_set_level_up(struct btree_trans *trans,
btree_path_set_dirty(path, BTREE_ITER_NEED_TRAVERSE); btree_path_set_dirty(path, BTREE_ITER_NEED_TRAVERSE);
} }
struct six_lock_count bch2_btree_node_lock_counts(struct btree_trans *,
struct btree_path *, struct btree *, unsigned);
#endif /* _BCACHEFS_BTREE_LOCKING_H */ #endif /* _BCACHEFS_BTREE_LOCKING_H */
...@@ -994,8 +994,7 @@ bch2_btree_update_start(struct btree_trans *trans, struct btree_path *path, ...@@ -994,8 +994,7 @@ bch2_btree_update_start(struct btree_trans *trans, struct btree_path *path,
nr_nodes[1] += 1; nr_nodes[1] += 1;
if (!bch2_btree_path_upgrade(trans, path, U8_MAX)) { if (!bch2_btree_path_upgrade(trans, path, U8_MAX)) {
trace_trans_restart_iter_upgrade(trans->fn, _RET_IP_, trace_trans_restart_iter_upgrade(trans, _RET_IP_, path);
path->btree_id, &path->pos);
ret = btree_trans_restart(trans, BCH_ERR_transaction_restart_upgrade); ret = btree_trans_restart(trans, BCH_ERR_transaction_restart_upgrade);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
...@@ -1053,7 +1052,7 @@ bch2_btree_update_start(struct btree_trans *trans, struct btree_path *path, ...@@ -1053,7 +1052,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->fn, _RET_IP_); trace_trans_restart_journal_preres_get(trans, _RET_IP_);
ret = btree_trans_restart(trans, BCH_ERR_transaction_restart_journal_preres_get); ret = btree_trans_restart(trans, BCH_ERR_transaction_restart_journal_preres_get);
goto err; goto err;
} }
......
...@@ -285,7 +285,7 @@ bch2_trans_journal_preres_get_cold(struct btree_trans *trans, unsigned u64s, ...@@ -285,7 +285,7 @@ bch2_trans_journal_preres_get_cold(struct btree_trans *trans, unsigned u64s,
ret = bch2_trans_relock(trans); ret = bch2_trans_relock(trans);
if (ret) { if (ret) {
trace_trans_restart_journal_preres_get(trans->fn, trace_ip); trace_trans_restart_journal_preres_get(trans, trace_ip);
return ret; return ret;
} }
...@@ -375,9 +375,7 @@ btree_key_can_insert_cached(struct btree_trans *trans, ...@@ -375,9 +375,7 @@ btree_key_can_insert_cached(struct btree_trans *trans,
* Keys returned by peek() are no longer valid pointers, so we need a * Keys returned by peek() are no longer valid pointers, so we need a
* transaction restart: * transaction restart:
*/ */
trace_trans_restart_key_cache_key_realloced(trans->fn, _RET_IP_, trace_trans_restart_key_cache_key_realloced(trans, _RET_IP_, path, old_u64s, new_u64s);
path->btree_id, &path->pos,
old_u64s, new_u64s);
return btree_trans_restart_nounlock(trans, BCH_ERR_transaction_restart_key_cache_realloced); return btree_trans_restart_nounlock(trans, BCH_ERR_transaction_restart_key_cache_realloced);
} }
...@@ -569,7 +567,7 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, ...@@ -569,7 +567,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->fn, trace_ip); trace_trans_restart_fault_inject(trans, trace_ip);
return btree_trans_restart_nounlock(trans, BCH_ERR_transaction_restart_fault_inject); return btree_trans_restart_nounlock(trans, BCH_ERR_transaction_restart_fault_inject);
} }
...@@ -837,7 +835,7 @@ static inline int trans_lock_write(struct btree_trans *trans) ...@@ -837,7 +835,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->fn); trace_trans_restart_would_deadlock_write(trans);
return btree_trans_restart(trans, BCH_ERR_transaction_restart_would_deadlock_write); return btree_trans_restart(trans, BCH_ERR_transaction_restart_would_deadlock_write);
} }
...@@ -970,8 +968,7 @@ int bch2_trans_commit_error(struct btree_trans *trans, ...@@ -970,8 +968,7 @@ int bch2_trans_commit_error(struct btree_trans *trans,
case BTREE_INSERT_BTREE_NODE_FULL: case BTREE_INSERT_BTREE_NODE_FULL:
ret = bch2_btree_split_leaf(trans, i->path, trans->flags); ret = bch2_btree_split_leaf(trans, i->path, trans->flags);
if (bch2_err_matches(ret, BCH_ERR_transaction_restart)) if (bch2_err_matches(ret, BCH_ERR_transaction_restart))
trace_trans_restart_btree_node_split(trans->fn, trace_ip, trace_trans_restart_btree_node_split(trans, trace_ip, i->path);
i->btree_id, &i->path->pos);
break; break;
case BTREE_INSERT_NEED_MARK_REPLICAS: case BTREE_INSERT_NEED_MARK_REPLICAS:
bch2_trans_unlock(trans); bch2_trans_unlock(trans);
...@@ -982,7 +979,7 @@ int bch2_trans_commit_error(struct btree_trans *trans, ...@@ -982,7 +979,7 @@ int bch2_trans_commit_error(struct btree_trans *trans,
ret = bch2_trans_relock(trans); ret = bch2_trans_relock(trans);
if (ret) if (ret)
trace_trans_restart_mark_replicas(trans->fn, trace_ip); trace_trans_restart_mark_replicas(trans, trace_ip);
break; break;
case BTREE_INSERT_NEED_JOURNAL_RES: case BTREE_INSERT_NEED_JOURNAL_RES:
bch2_trans_unlock(trans); bch2_trans_unlock(trans);
...@@ -999,12 +996,12 @@ int bch2_trans_commit_error(struct btree_trans *trans, ...@@ -999,12 +996,12 @@ int bch2_trans_commit_error(struct btree_trans *trans,
ret = bch2_trans_relock(trans); ret = bch2_trans_relock(trans);
if (ret) if (ret)
trace_trans_restart_journal_res_get(trans->fn, trace_ip); trace_trans_restart_journal_res_get(trans, trace_ip);
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->fn, trace_ip); trace_trans_blocked_journal_reclaim(trans, 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)));
...@@ -1013,7 +1010,7 @@ int bch2_trans_commit_error(struct btree_trans *trans, ...@@ -1013,7 +1010,7 @@ int bch2_trans_commit_error(struct btree_trans *trans,
ret = bch2_trans_relock(trans); ret = bch2_trans_relock(trans);
if (ret) if (ret)
trace_trans_restart_journal_reclaim(trans->fn, trace_ip); trace_trans_restart_journal_reclaim(trans, trace_ip);
break; break;
default: default:
BUG_ON(ret >= 0); BUG_ON(ret >= 0);
...@@ -1116,8 +1113,7 @@ int __bch2_trans_commit(struct btree_trans *trans) ...@@ -1116,8 +1113,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->fn, _RET_IP_, trace_trans_restart_upgrade(trans, _RET_IP_, i->path);
i->btree_id, &i->path->pos);
ret = btree_trans_restart(trans, BCH_ERR_transaction_restart_upgrade); ret = btree_trans_restart(trans, BCH_ERR_transaction_restart_upgrade);
goto out; goto out;
} }
...@@ -1163,7 +1159,7 @@ int __bch2_trans_commit(struct btree_trans *trans) ...@@ -1163,7 +1159,7 @@ int __bch2_trans_commit(struct btree_trans *trans)
if (ret) if (ret)
goto err; goto err;
trace_transaction_commit(trans->fn, _RET_IP_); trace_transaction_commit(trans, _RET_IP_);
out: out:
bch2_journal_preres_put(&c->journal, &trans->journal_preres); bch2_journal_preres_put(&c->journal, &trans->journal_preres);
...@@ -1639,7 +1635,7 @@ int __must_check bch2_trans_update(struct btree_trans *trans, struct btree_iter ...@@ -1639,7 +1635,7 @@ int __must_check bch2_trans_update(struct btree_trans *trans, struct btree_iter
ck = (void *) iter->key_cache_path->l[0].b; ck = (void *) iter->key_cache_path->l[0].b;
if (test_bit(BKEY_CACHED_DIRTY, &ck->flags)) { if (test_bit(BKEY_CACHED_DIRTY, &ck->flags)) {
trace_trans_restart_key_cache_raced(trans->fn, _RET_IP_); trace_trans_restart_key_cache_raced(trans, _RET_IP_);
return btree_trans_restart(trans, BCH_ERR_transaction_restart_key_cache_raced); return btree_trans_restart(trans, BCH_ERR_transaction_restart_key_cache_raced);
} }
......
...@@ -2,8 +2,10 @@ ...@@ -2,8 +2,10 @@
#include "bcachefs.h" #include "bcachefs.h"
#include "alloc_types.h" #include "alloc_types.h"
#include "buckets.h" #include "buckets.h"
#include "btree_types.h" #include "btree_iter.h"
#include "btree_locking.h"
#include "keylist.h" #include "keylist.h"
#include "opts.h"
#include "six.h" #include "six.h"
#include <linux/blktrace_api.h> #include <linux/blktrace_api.h>
......
This diff is collapsed.
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