diff options
author | Nicholas Sielicki <linux@opensource.nslick.com> | 2023-10-18 23:39:04 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-11-08 11:32:40 -0500 |
commit | 81352a29bc619c5882cbdd23dbdaa83ae9e3baee (patch) | |
tree | 1c50b0c0189ce344aaa178dfafeef88164fbea85 | |
parent | 974d9bf0001b330995c5bde3b5a16adab8037262 (diff) | |
download | bcachefs-tools-81352a29bc619c5882cbdd23dbdaa83ae9e3baee.tar.gz |
btree_write_buffer: ensure atomic64_sub_return_release availability
prior to this patch, on certain platforms (ie: armv7l), compilation fails due
to atomic64_sub_return_release not being defined here. Ensure that the atomics
header is pulled in, and ensure that it is available in all cases, regardless
of whether ATOMIC64_SPINLOCK is defined.
Signed-off-by: Nicholas Sielicki <linux@opensource.nslick.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | include/linux/atomic.h | 6 | ||||
-rw-r--r-- | libbcachefs/btree_write_buffer.c | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/atomic.h b/include/linux/atomic.h index f1464cf3..2c983cd4 100644 --- a/include/linux/atomic.h +++ b/include/linux/atomic.h @@ -324,6 +324,12 @@ static inline s64 atomic64_cmpxchg_acquire(atomic64_t *v, s64 old, s64 new) return atomic64_cmpxchg(v, old, new); } +static inline s64 atomic64_sub_return_release(s64 i, atomic64_t *v) +{ + smp_mb__before_atomic(); + return atomic64_sub_return(i, v); +} + #endif #endif /* __TOOLS_LINUX_ATOMIC_H */ diff --git a/libbcachefs/btree_write_buffer.c b/libbcachefs/btree_write_buffer.c index 4e6241db..76b6f2dc 100644 --- a/libbcachefs/btree_write_buffer.c +++ b/libbcachefs/btree_write_buffer.c @@ -9,6 +9,7 @@ #include "journal.h" #include "journal_reclaim.h" +#include <linux/atomic.h> #include <linux/sort.h> static int btree_write_buffered_key_cmp(const void *_l, const void *_r) |