summaryrefslogtreecommitdiff
path: root/libbcachefs/btree_iter.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-02-20 18:55:08 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-02-20 20:03:34 -0500
commitda6a35689518599b381c285cd9505ab8d58f7c73 (patch)
tree20ae5acb9ca8f8a89a45aa52a092be8d13f29d74 /libbcachefs/btree_iter.h
parent46a6b9210c927ab46fd1227cb6f641be0b4a7505 (diff)
Update bcachefs sources to 8e1519ccb6 bcachefs: Add tracepoint & counter for btree split race
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'libbcachefs/btree_iter.h')
-rw-r--r--libbcachefs/btree_iter.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/libbcachefs/btree_iter.h b/libbcachefs/btree_iter.h
index 0ede02c3..1225c4dd 100644
--- a/libbcachefs/btree_iter.h
+++ b/libbcachefs/btree_iter.h
@@ -198,6 +198,15 @@ struct bkey_i *bch2_btree_journal_peek_slot(struct btree_trans *,
void bch2_btree_path_level_init(struct btree_trans *, struct btree_path *, struct btree *);
+int __bch2_trans_mutex_lock(struct btree_trans *, struct mutex *);
+
+static inline int bch2_trans_mutex_lock(struct btree_trans *trans, struct mutex *lock)
+{
+ return mutex_trylock(lock)
+ ? 0
+ : __bch2_trans_mutex_lock(trans, lock);
+}
+
#ifdef CONFIG_BCACHEFS_DEBUG
void bch2_trans_verify_paths(struct btree_trans *);
void bch2_assert_pos_locked(struct btree_trans *, enum btree_id,
@@ -252,6 +261,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;
}