summaryrefslogtreecommitdiff
path: root/fs/bcachefs/six.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-08-27 23:22:51 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:41 +0300
commit0bfb9f42b7b16aa11a7b5d283b0b7b98d11476b7 (patch)
tree4be6d962010b65ac0b4d0937ea5d5aeb68b30f8d /fs/bcachefs/six.h
parentebc6f76a667f5fc599a5f76515f6881dfb82af2f (diff)
downloadlinux-0bfb9f42b7b16aa11a7b5d283b0b7b98d11476b7.tar.xz
six locks: six_lock_waiter()
This allows passing in the wait list entry - to be used for a deadlock cycle detector. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/six.h')
-rw-r--r--fs/bcachefs/six.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/bcachefs/six.h b/fs/bcachefs/six.h
index 0e55845195d9..ab06773e8094 100644
--- a/fs/bcachefs/six.h
+++ b/fs/bcachefs/six.h
@@ -156,6 +156,8 @@ do { \
bool six_trylock_##type(struct six_lock *); \
bool six_relock_##type(struct six_lock *, u32); \
int six_lock_##type(struct six_lock *, six_lock_should_sleep_fn, void *);\
+int six_lock_waiter_##type(struct six_lock *, struct six_lock_waiter *, \
+ six_lock_should_sleep_fn, void *); \
void six_unlock_##type(struct six_lock *);
__SIX_LOCK(read)
@@ -192,6 +194,13 @@ static inline int six_lock_type(struct six_lock *lock, enum six_lock_type type,
SIX_LOCK_DISPATCH(type, six_lock, lock, should_sleep_fn, p);
}
+static inline int six_lock_type_waiter(struct six_lock *lock, enum six_lock_type type,
+ struct six_lock_waiter *wait,
+ six_lock_should_sleep_fn should_sleep_fn, void *p)
+{
+ SIX_LOCK_DISPATCH(type, six_lock_waiter, lock, wait, should_sleep_fn, p);
+}
+
static inline void six_unlock_type(struct six_lock *lock, enum six_lock_type type)
{
SIX_LOCK_DISPATCH(type, six_unlock, lock);