Lines Matching refs:sb

101 	struct sbitmap sb;  member
155 int sbitmap_init_node(struct sbitmap *sb, unsigned int depth, int shift,
162 static inline void sbitmap_free(struct sbitmap *sb) in sbitmap_free() argument
164 kfree(sb->map); in sbitmap_free()
165 sb->map = NULL; in sbitmap_free()
176 void sbitmap_resize(struct sbitmap *sb, unsigned int depth);
190 int sbitmap_get(struct sbitmap *sb, unsigned int alloc_hint, bool round_robin);
208 int sbitmap_get_shallow(struct sbitmap *sb, unsigned int alloc_hint,
217 bool sbitmap_any_bit_set(const struct sbitmap *sb);
219 #define SB_NR_TO_INDEX(sb, bitnr) ((bitnr) >> (sb)->shift) argument
220 #define SB_NR_TO_BIT(sb, bitnr) ((bitnr) & ((1U << (sb)->shift) - 1U)) argument
234 static inline void __sbitmap_for_each_set(struct sbitmap *sb, in __sbitmap_for_each_set() argument
242 if (start >= sb->depth) in __sbitmap_for_each_set()
244 index = SB_NR_TO_INDEX(sb, start); in __sbitmap_for_each_set()
245 nr = SB_NR_TO_BIT(sb, start); in __sbitmap_for_each_set()
247 while (scanned < sb->depth) { in __sbitmap_for_each_set()
250 sb->map[index].depth - nr, in __sbitmap_for_each_set()
251 sb->depth - scanned); in __sbitmap_for_each_set()
254 word = sb->map[index].word & ~sb->map[index].cleared; in __sbitmap_for_each_set()
268 if (!fn(sb, (index << sb->shift) + nr, data)) in __sbitmap_for_each_set()
275 if (++index >= sb->map_nr) in __sbitmap_for_each_set()
286 static inline void sbitmap_for_each_set(struct sbitmap *sb, sb_for_each_fn fn, in sbitmap_for_each_set() argument
289 __sbitmap_for_each_set(sb, 0, fn, data); in sbitmap_for_each_set()
292 static inline unsigned long *__sbitmap_word(struct sbitmap *sb, in __sbitmap_word() argument
295 return &sb->map[SB_NR_TO_INDEX(sb, bitnr)].word; in __sbitmap_word()
300 static inline void sbitmap_set_bit(struct sbitmap *sb, unsigned int bitnr) in sbitmap_set_bit() argument
302 set_bit(SB_NR_TO_BIT(sb, bitnr), __sbitmap_word(sb, bitnr)); in sbitmap_set_bit()
305 static inline void sbitmap_clear_bit(struct sbitmap *sb, unsigned int bitnr) in sbitmap_clear_bit() argument
307 clear_bit(SB_NR_TO_BIT(sb, bitnr), __sbitmap_word(sb, bitnr)); in sbitmap_clear_bit()
316 static inline void sbitmap_deferred_clear_bit(struct sbitmap *sb, unsigned int bitnr) in sbitmap_deferred_clear_bit() argument
318 unsigned long *addr = &sb->map[SB_NR_TO_INDEX(sb, bitnr)].cleared; in sbitmap_deferred_clear_bit()
320 set_bit(SB_NR_TO_BIT(sb, bitnr), addr); in sbitmap_deferred_clear_bit()
323 static inline void sbitmap_clear_bit_unlock(struct sbitmap *sb, in sbitmap_clear_bit_unlock() argument
326 clear_bit_unlock(SB_NR_TO_BIT(sb, bitnr), __sbitmap_word(sb, bitnr)); in sbitmap_clear_bit_unlock()
329 static inline int sbitmap_test_bit(struct sbitmap *sb, unsigned int bitnr) in sbitmap_test_bit() argument
331 return test_bit(SB_NR_TO_BIT(sb, bitnr), __sbitmap_word(sb, bitnr)); in sbitmap_test_bit()
341 void sbitmap_show(struct sbitmap *sb, struct seq_file *m);
352 void sbitmap_bitmap_show(struct sbitmap *sb, struct seq_file *m);
378 sbitmap_free(&sbq->sb); in sbitmap_queue_free()