summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/linux/atomic.h6
-rw-r--r--libbcachefs/btree_write_buffer.c1
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)