bcachefs: Split trans->last_begin_ip and trans->last_restarted_ip
authorKent Overstreet <kent.overstreet@linux.dev>
Sun, 19 Feb 2023 02:20:18 +0000 (21:20 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:53 +0000 (17:09 -0400)
These are two different things - this improves our debug assert
messages.

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

index 5ab22c4c2b2eb2760de221b110a552900afae958..63213205a043291565cbe5b553381e4750d43f7b 100644 (file)
@@ -976,6 +976,7 @@ static int bch2_btree_path_traverse_all(struct btree_trans *trans)
        trans->in_traverse_all = true;
 retry_all:
        trans->restarted = 0;
+       trans->last_restarted_ip = 0;
 
        trans_for_each_path(trans, path)
                path->should_be_locked = false;
@@ -1360,7 +1361,7 @@ void __noreturn bch2_trans_restart_error(struct btree_trans *trans, u32 restart_
 {
        panic("trans->restart_count %u, should be %u, last restarted by %pS\n",
              trans->restart_count, restart_count,
-             (void *) trans->last_restarted_ip);
+             (void *) trans->last_begin_ip);
 }
 
 void __noreturn bch2_trans_in_restart_error(struct btree_trans *trans)
@@ -2865,7 +2866,7 @@ u32 bch2_trans_begin(struct btree_trans *trans)
        if (unlikely(time_after(jiffies, trans->srcu_lock_time + msecs_to_jiffies(10))))
                bch2_trans_reset_srcu_lock(trans);
 
-       trans->last_restarted_ip = _RET_IP_;
+       trans->last_begin_ip = _RET_IP_;
        if (trans->restarted) {
                bch2_btree_path_traverse_all(trans);
                trans->notrace_relock_fail = false;
index 458c7f7dc5b75229130c92515b44acfe4fae8ca8..50b39704c56fbe5a07c74092be5c88b4573fba1a 100644 (file)
@@ -260,6 +260,7 @@ static inline int btree_trans_restart_nounlock(struct btree_trans *trans, int er
        BUG_ON(!bch2_err_matches(err, BCH_ERR_transaction_restart));
 
        trans->restarted = err;
+       trans->last_restarted_ip = _THIS_IP_;
        return -err;
 }
 
index 9fdddfb15782d9fc1eb57ee8527de06d6abfb688..38bc2a1d198b803fc95ae1f64263cf13b6e49911 100644 (file)
@@ -431,6 +431,7 @@ struct btree_trans {
        bool                    notrace_relock_fail:1;
        enum bch_errcode        restarted:16;
        u32                     restart_count;
+       unsigned long           last_begin_ip;
        unsigned long           last_restarted_ip;
        unsigned long           srcu_lock_time;