diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-08-27 22:22:51 +0200 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:09:41 +0200 |
commit | 0bfb9f42b7b16aa11a7b5d283b0b7b98d11476b7 (patch) | |
tree | 4be6d962010b65ac0b4d0937ea5d5aeb68b30f8d /fs/bcachefs/six.h | |
parent | six locks: Simplify wait lists (diff) | |
download | linux-0bfb9f42b7b16aa11a7b5d283b0b7b98d11476b7.tar.xz linux-0bfb9f42b7b16aa11a7b5d283b0b7b98d11476b7.zip |
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.h | 9 |
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); |