]> git.sesse.net Git - bcachefs-tools-debian/commitdiff
btree_write_buffer: ensure atomic64_sub_return_release availability
authorNicholas Sielicki <linux@opensource.nslick.com>
Thu, 19 Oct 2023 04:39:04 +0000 (23:39 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Wed, 8 Nov 2023 16:32:40 +0000 (11:32 -0500)
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>
include/linux/atomic.h
libbcachefs/btree_write_buffer.c

index f1464cf3e0c371721745f78de13b2f03496eecc0..2c983cd4efb871822a0ef5652235759d3bcb4b86 100644 (file)
@@ -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 */
index 4e6241db518b59d62c551e3d6d9c2541fd87737a..76b6f2dcaa4fb7889b2e3de3b5a48d57b7723868 100644 (file)
@@ -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)