summaryrefslogtreecommitdiff
path: root/libbcachefs/btree_iter.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-11-29 17:00:30 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-11-29 17:00:30 -0500
commit89b361f24a433a4a55e0032eca4e43045ea3f0d0 (patch)
treec405bc713dae3118593e2299de7fe18d7a291745 /libbcachefs/btree_iter.c
parent1dc5842111fa587eb58112f4ae3c2048b1c1a006 (diff)
Update bcachefs sources to c3e4d892b77b mean and variance: Promote to lib/math
Diffstat (limited to 'libbcachefs/btree_iter.c')
-rw-r--r--libbcachefs/btree_iter.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/libbcachefs/btree_iter.c b/libbcachefs/btree_iter.c
index bdc80808..f430ca83 100644
--- a/libbcachefs/btree_iter.c
+++ b/libbcachefs/btree_iter.c
@@ -1492,6 +1492,22 @@ static void bch2_trans_update_max_paths(struct btree_trans *trans)
trans->nr_max_paths = hweight64(trans->paths_allocated);
}
+noinline __cold
+int __bch2_btree_trans_too_many_iters(struct btree_trans *trans)
+{
+ if (trace_trans_restart_too_many_iters_enabled()) {
+ struct printbuf buf = PRINTBUF;
+
+ bch2_trans_paths_to_text(&buf, trans);
+ trace_trans_restart_too_many_iters(trans, _THIS_IP_, buf.buf);
+ printbuf_exit(&buf);
+ }
+
+ count_event(trans->c, trans_restart_too_many_iters);
+
+ return btree_trans_restart(trans, BCH_ERR_transaction_restart_too_many_iters);
+}
+
static noinline void btree_path_overflow(struct btree_trans *trans)
{
bch2_dump_trans_paths_updates(trans);
@@ -3027,6 +3043,7 @@ void bch2_btree_trans_to_text(struct printbuf *out, struct btree_trans *trans)
struct btree_path *path;
struct btree_bkey_cached_common *b;
static char lock_types[] = { 'r', 'i', 'w' };
+ struct task_struct *task = READ_ONCE(trans->locking_wait.task);
unsigned l, idx;
if (!out->nr_tabstops) {
@@ -3034,7 +3051,7 @@ void bch2_btree_trans_to_text(struct printbuf *out, struct btree_trans *trans)
printbuf_tabstop_push(out, 32);
}
- prt_printf(out, "%i %s\n", trans->locking_wait.task->pid, trans->fn);
+ prt_printf(out, "%i %s\n", task ? task->pid : 0, trans->fn);
trans_for_each_path_safe(trans, path, idx) {
if (!path->nodes_locked)