From: Nicholas Sielicki Date: Thu, 19 Oct 2023 04:39:04 +0000 (-0500) Subject: btree_write_buffer: ensure atomic64_sub_return_release availability X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=81352a29bc619c5882cbdd23dbdaa83ae9e3baee;p=bcachefs-tools-debian 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 Signed-off-by: Kent Overstreet --- diff --git a/include/linux/atomic.h b/include/linux/atomic.h index f1464cf..2c983cd 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 4e6241d..76b6f2d 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 #include static int btree_write_buffered_key_cmp(const void *_l, const void *_r)