]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: btree_trans_too_many_iters() is now a transaction restart
authorKent Overstreet <kent.overstreet@gmail.com>
Tue, 5 Jul 2022 21:27:44 +0000 (17:27 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:36 +0000 (17:09 -0400)
All transaction restarts need a tracepoint - this is essential for
debugging

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_iter.h
fs/bcachefs/trace.h

index c2f5afc9eeb97dd90c42e88f1529b9c4440c03e4..1952a7683610271ce3e7c58b95fc0f85f476293d 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "bset.h"
 #include "btree_types.h"
+#include "trace.h"
 
 static inline void __btree_path_get(struct btree_path *path, bool intent)
 {
@@ -384,8 +385,12 @@ 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)
 {
-       return hweight64(trans->paths_allocated) > BTREE_ITER_MAX / 2
-               ? -EINTR : 0;
+       if (hweight64(trans->paths_allocated) > BTREE_ITER_MAX / 2) {
+               trace_trans_restart_too_many_iters(trans->fn, _THIS_IP_);
+               return btree_trans_restart(trans);
+       }
+
+       return 0;
 }
 
 static inline struct bkey_s_c
index 65c38aa383595a4b27ccf6fdd2f640616666621a..a52da91f279e6060a78cc00f105e82a17ba414ab 100644 (file)
@@ -755,6 +755,12 @@ DEFINE_EVENT(transaction_event,    trans_restart_key_cache_raced,
        TP_ARGS(trans_fn, caller_ip)
 );
 
+DEFINE_EVENT(transaction_event,        trans_restart_too_many_iters,
+       TP_PROTO(const char *trans_fn,
+                unsigned long caller_ip),
+       TP_ARGS(trans_fn, caller_ip)
+);
+
 DECLARE_EVENT_CLASS(transaction_restart_iter,
        TP_PROTO(const char *trans_fn,
                 unsigned long caller_ip,