From b5fd75669ab1283e7a9caf6288c425108bd382b0 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Sun, 28 May 2023 18:06:27 -0400 Subject: bcachefs: drop_locks_do() Add a new helper for the common pattern of: - trans_unlock() - do something - trans_relock() Signed-off-by: Kent Overstreet --- fs/bcachefs/btree_locking.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'fs/bcachefs/btree_locking.c') 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; -- cgit v1.2.3