summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/btree_locking.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-05-29 00:06:27 +0200
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 23:10:03 +0200
commitb5fd75669ab1283e7a9caf6288c425108bd382b0 (patch)
tree65003eef4cafbff47425bc4e726c2ab895c91e9d /fs/bcachefs/btree_locking.c
parentbcachefs: GFP_NOIO -> GFP_NOFS (diff)
downloadlinux-b5fd75669ab1283e7a9caf6288c425108bd382b0.tar.xz
linux-b5fd75669ab1283e7a9caf6288c425108bd382b0.zip
bcachefs: drop_locks_do()
Add a new helper for the common pattern of: - trans_unlock() - do something - trans_relock() Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_locking.c')
-rw-r--r--fs/bcachefs/btree_locking.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/fs/bcachefs/btree_locking.c b/fs/bcachefs/btree_locking.c
index 1f4eca898ab7..23a6d63223af 100644
--- a/fs/bcachefs/btree_locking.c
+++ b/fs/bcachefs/btree_locking.c
@@ -736,11 +736,8 @@ bool bch2_trans_locked(struct btree_trans *trans)
int __bch2_trans_mutex_lock(struct btree_trans *trans,
struct mutex *lock)
{
- int ret;
+ int ret = drop_locks_do(trans, (mutex_lock(lock), 0));
- bch2_trans_unlock(trans);
- mutex_lock(lock);
- ret = bch2_trans_relock(trans);
if (ret)
mutex_unlock(lock);
return ret;