diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-06-28 18:11:46 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-06-28 18:26:04 -0400 |
commit | 34b5654d9eb1999704e75d964645e3aa9b78e249 (patch) | |
tree | 27269b040f9128cf33155a9ca47038703efc5606 /libbcachefs/util.h | |
parent | b0eb3c29304f9a4ca39c8534bb6476b170b2a7d0 (diff) |
Update bcachefs sources to 9404a01d3dc5 bcachefs: Make read_only a mount option again, but hiddenv1.9.2
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'libbcachefs/util.h')
-rw-r--r-- | libbcachefs/util.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/libbcachefs/util.h b/libbcachefs/util.h index f4dd09c4..76ffe08e 100644 --- a/libbcachefs/util.h +++ b/libbcachefs/util.h @@ -697,14 +697,19 @@ do { \ } \ } while (0) +#define per_cpu_sum(_p) \ +({ \ + typeof(*_p) _ret = 0; \ + \ + int cpu; \ + for_each_possible_cpu(cpu) \ + _ret += *per_cpu_ptr(_p, cpu); \ + _ret; \ +}) + static inline u64 percpu_u64_get(u64 __percpu *src) { - u64 ret = 0; - int cpu; - - for_each_possible_cpu(cpu) - ret += *per_cpu_ptr(src, cpu); - return ret; + return per_cpu_sum(src); } static inline void percpu_u64_set(u64 __percpu *dst, u64 src) |