summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-09-25 16:42:53 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:41 -0400
commite9174370d0522b466ea770576230b487941101f8 (patch)
treecc7806524495ea81cf7ffed5d7f9a0d97845f2de /fs
parentc36ff038fd3af6092e356cb4ed1c79a041b77b19 (diff)
downloadlinux-stable-e9174370d0522b466ea770576230b487941101f8.tar.gz
linux-stable-e9174370d0522b466ea770576230b487941101f8.tar.bz2
linux-stable-e9174370d0522b466ea770576230b487941101f8.zip
bcachefs: bch2_btree_node_relock_notrace()
Most of the node_relock_fail trace events are generated from bch2_btree_path_verify_level(), when debugcheck_iterators is enabled - but we're not interested in these trace events, they don't indicate that we're in a slowpath. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/btree_iter.c2
-rw-r--r--fs/bcachefs/btree_locking.c6
-rw-r--r--fs/bcachefs/btree_locking.h16
3 files changed, 19 insertions, 5 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 962010230c41..237e5c0afffa 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -167,7 +167,7 @@ static void bch2_btree_path_verify_level(struct btree_trans *trans,
if (!btree_path_node(path, level))
return;
- if (!bch2_btree_node_relock(trans, path, level))
+ if (!bch2_btree_node_relock_notrace(trans, path, level))
return;
BUG_ON(!btree_path_pos_in_node(path, l->b));
diff --git a/fs/bcachefs/btree_locking.c b/fs/bcachefs/btree_locking.c
index 6793d7dd18d7..19062cea8774 100644
--- a/fs/bcachefs/btree_locking.c
+++ b/fs/bcachefs/btree_locking.c
@@ -401,7 +401,8 @@ static inline bool btree_path_get_locks(struct btree_trans *trans,
}
bool __bch2_btree_node_relock(struct btree_trans *trans,
- struct btree_path *path, unsigned level)
+ struct btree_path *path, unsigned level,
+ bool trace)
{
struct btree *b = btree_path_node(path, level);
int want = __btree_lock_want(path, level);
@@ -416,7 +417,8 @@ bool __bch2_btree_node_relock(struct btree_trans *trans,
return true;
}
fail:
- trace_and_count(trans->c, btree_path_relock_fail, trans, _RET_IP_, path, level);
+ if (trace)
+ trace_and_count(trans->c, btree_path_relock_fail, trans, _RET_IP_, path, level);
return false;
}
diff --git a/fs/bcachefs/btree_locking.h b/fs/bcachefs/btree_locking.h
index 95089693a420..c74a5fd4d908 100644
--- a/fs/bcachefs/btree_locking.h
+++ b/fs/bcachefs/btree_locking.h
@@ -317,7 +317,7 @@ static inline int bch2_btree_path_relock(struct btree_trans *trans,
: __bch2_btree_path_relock(trans, path, trace_ip);
}
-bool __bch2_btree_node_relock(struct btree_trans *, struct btree_path *, unsigned);
+bool __bch2_btree_node_relock(struct btree_trans *, struct btree_path *, unsigned, bool trace);
static inline bool bch2_btree_node_relock(struct btree_trans *trans,
struct btree_path *path, unsigned level)
@@ -328,7 +328,19 @@ static inline bool bch2_btree_node_relock(struct btree_trans *trans,
return likely(btree_node_locked(path, level)) ||
(!IS_ERR_OR_NULL(path->l[level].b) &&
- __bch2_btree_node_relock(trans, path, level));
+ __bch2_btree_node_relock(trans, path, level, true));
+}
+
+static inline bool bch2_btree_node_relock_notrace(struct btree_trans *trans,
+ struct btree_path *path, unsigned level)
+{
+ EBUG_ON(btree_node_locked(path, level) &&
+ !btree_node_write_locked(path, level) &&
+ btree_node_locked_type(path, level) != __btree_lock_want(path, level));
+
+ return likely(btree_node_locked(path, level)) ||
+ (!IS_ERR_OR_NULL(path->l[level].b) &&
+ __bch2_btree_node_relock(trans, path, level, false));
}
/* upgrade */