diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-06-04 18:10:23 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-06-04 18:10:29 -0400 |
commit | 8642d4ae10f167a2eb850403f6d2b60757242b31 (patch) | |
tree | 6cd7f6586f779a806e7f33c8f3e76aebc1cf1064 /include/linux/atomic.h | |
parent | 1f78fed4693a5361f56508daac59bebd5b556379 (diff) |
Update bcachefs sources to 7c0fe6f104 bcachefs: Fix bch2_fsck_ask_yn()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'include/linux/atomic.h')
-rw-r--r-- | include/linux/atomic.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/atomic.h b/include/linux/atomic.h index 79cf5aa9..f4d047c1 100644 --- a/include/linux/atomic.h +++ b/include/linux/atomic.h @@ -271,6 +271,13 @@ static inline i_type a_type##_cmpxchg(a_type##_t *v, i_type old, i_type new)\ static inline i_type a_type##_cmpxchg_acquire(a_type##_t *v, i_type old, i_type new)\ { \ return cmpxchg_acquire(&v->counter, old, new); \ +} \ + \ +static inline bool a_type##_try_cmpxchg_acquire(a_type##_t *v, i_type *old, i_type new)\ +{ \ + i_type prev = *old; \ + *old = cmpxchg_acquire(&v->counter, *old, new); \ + return prev == *old; \ } DEF_ATOMIC_OPS(atomic, int) |