Lines Matching refs:sb

102 	struct sbitmap sb;  member
151 int sbitmap_init_node(struct sbitmap *sb, unsigned int depth, int shift,
158 static inline void sbitmap_free(struct sbitmap *sb) in sbitmap_free() argument
160 kfree(sb->map); in sbitmap_free()
161 sb->map = NULL; in sbitmap_free()
172 void sbitmap_resize(struct sbitmap *sb, unsigned int depth);
186 int sbitmap_get(struct sbitmap *sb, unsigned int alloc_hint, bool round_robin);
204 int sbitmap_get_shallow(struct sbitmap *sb, unsigned int alloc_hint,
213 bool sbitmap_any_bit_set(const struct sbitmap *sb);
222 bool sbitmap_any_bit_clear(const struct sbitmap *sb);
224 #define SB_NR_TO_INDEX(sb, bitnr) ((bitnr) >> (sb)->shift) argument
225 #define SB_NR_TO_BIT(sb, bitnr) ((bitnr) & ((1U << (sb)->shift) - 1U)) argument
239 static inline void __sbitmap_for_each_set(struct sbitmap *sb, in __sbitmap_for_each_set() argument
247 if (start >= sb->depth) in __sbitmap_for_each_set()
249 index = SB_NR_TO_INDEX(sb, start); in __sbitmap_for_each_set()
250 nr = SB_NR_TO_BIT(sb, start); in __sbitmap_for_each_set()
252 while (scanned < sb->depth) { in __sbitmap_for_each_set()
253 struct sbitmap_word *word = &sb->map[index]; in __sbitmap_for_each_set()
255 sb->depth - scanned); in __sbitmap_for_each_set()
271 if (!fn(sb, (index << sb->shift) + nr, data)) in __sbitmap_for_each_set()
278 if (++index >= sb->map_nr) in __sbitmap_for_each_set()
289 static inline void sbitmap_for_each_set(struct sbitmap *sb, sb_for_each_fn fn, in sbitmap_for_each_set() argument
292 __sbitmap_for_each_set(sb, 0, fn, data); in sbitmap_for_each_set()
295 static inline unsigned long *__sbitmap_word(struct sbitmap *sb, in __sbitmap_word() argument
298 return &sb->map[SB_NR_TO_INDEX(sb, bitnr)].word; in __sbitmap_word()
303 static inline void sbitmap_set_bit(struct sbitmap *sb, unsigned int bitnr) in sbitmap_set_bit() argument
305 set_bit(SB_NR_TO_BIT(sb, bitnr), __sbitmap_word(sb, bitnr)); in sbitmap_set_bit()
308 static inline void sbitmap_clear_bit(struct sbitmap *sb, unsigned int bitnr) in sbitmap_clear_bit() argument
310 clear_bit(SB_NR_TO_BIT(sb, bitnr), __sbitmap_word(sb, bitnr)); in sbitmap_clear_bit()
313 static inline void sbitmap_clear_bit_unlock(struct sbitmap *sb, in sbitmap_clear_bit_unlock() argument
316 clear_bit_unlock(SB_NR_TO_BIT(sb, bitnr), __sbitmap_word(sb, bitnr)); in sbitmap_clear_bit_unlock()
319 static inline int sbitmap_test_bit(struct sbitmap *sb, unsigned int bitnr) in sbitmap_test_bit() argument
321 return test_bit(SB_NR_TO_BIT(sb, bitnr), __sbitmap_word(sb, bitnr)); in sbitmap_test_bit()
324 unsigned int sbitmap_weight(const struct sbitmap *sb);
333 void sbitmap_show(struct sbitmap *sb, struct seq_file *m);
344 void sbitmap_bitmap_show(struct sbitmap *sb, struct seq_file *m);
370 sbitmap_free(&sbq->sb); in sbitmap_queue_free()