summaryrefslogtreecommitdiff
path: root/fs/bcachefs/btree_locking.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-08-23 06:39:23 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:40 +0300
commitd5024b011cb37b03aeeddd4b38857db427a04f11 (patch)
tree2c3af9da12a9e206aedf01cab24dfdbd92b67a3b /fs/bcachefs/btree_locking.h
parentca7d8fcabf29fae627babb72bda9b51763f9a145 (diff)
downloadlinux-d5024b011cb37b03aeeddd4b38857db427a04f11.tar.xz
bcachefs: bch2_btree_node_lock_write_nofail()
Taking a write lock will be able to fail, with the new cycle detector - unless we pass it nofail, which is possible but not preferred. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_locking.h')
-rw-r--r--fs/bcachefs/btree_locking.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/bcachefs/btree_locking.h b/fs/bcachefs/btree_locking.h
index 32c28c1341e9..6eaf44fd3f37 100644
--- a/fs/bcachefs/btree_locking.h
+++ b/fs/bcachefs/btree_locking.h
@@ -281,7 +281,7 @@ static inline int btree_node_lock(struct btree_trans *trans,
void __bch2_btree_node_lock_write(struct btree_trans *, struct btree *);
-static inline void bch2_btree_node_lock_write(struct btree_trans *trans,
+static inline void bch2_btree_node_lock_write_nofail(struct btree_trans *trans,
struct btree_path *path,
struct btree *b)
{
@@ -300,6 +300,15 @@ static inline void bch2_btree_node_lock_write(struct btree_trans *trans,
__bch2_btree_node_lock_write(trans, b);
}
+static inline int __must_check
+bch2_btree_node_lock_write(struct btree_trans *trans,
+ struct btree_path *path,
+ struct btree *b)
+{
+ bch2_btree_node_lock_write_nofail(trans, path, b);
+ return 0;
+}
+
/* relock: */
bool bch2_btree_path_relock_norestart(struct btree_trans *,