summaryrefslogtreecommitdiff
path: root/include/linux/bitmap.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-06-10 22:13:01 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-06-10 22:15:00 -0400
commit17d1c4f4fe29453fbb4087eb5de8aa6f9e6605c7 (patch)
tree84a0fb52242d7890ff6b2eb8c449b696f2edd844 /include/linux/bitmap.h
parent7a66cf70c5d8b02f84595e5648c12e7422e4d03e (diff)
Update bcachefs sources to ed6b7f81a7 six locks: Disable percpu read lock mode in userspace
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'include/linux/bitmap.h')
-rw-r--r--include/linux/bitmap.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 80e8ecda..db2dfdb2 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -135,4 +135,12 @@ static inline unsigned long find_next_zero_bit(const unsigned long *addr, unsign
#define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
+static inline bool bitmap_empty(const unsigned long *src, unsigned nbits)
+{
+ if (small_const_nbits(nbits))
+ return ! (*src & BITMAP_LAST_WORD_MASK(nbits));
+
+ return find_first_bit(src, nbits) == nbits;
+}
+
#endif /* _PERF_BITOPS_H */