Lines Matching refs:bitmap
2 #include <linux/bitmap.h>
334 * each entry. The XA_FREE_MARK is only cleared when all bits in the bitmap
341 * leaf bitmap before doing a radix tree lookup.
344 * leaf, instead of allocating a 128-byte bitmap, we store the bits
346 * because we can always convert them into a bitmap entry.
349 * single 128-byte bitmap, we currently switch to a 576-byte node, put
350 * the 128-byte bitmap in the first entry and then start allocating extra
352 * data as a bitmap before moving to that scheme. I do not believe this
361 * RCU head in the bitmap, which adds a 2-pointer overhead to each 128-byte
362 * bitmap, which is excessive.
386 struct ida_bitmap *bitmap, *alloc = NULL;
397 bitmap = xas_find_marked(&xas, max / IDA_BITMAP_BITS, XA_FREE_MARK);
403 if (xa_is_value(bitmap)) {
404 unsigned long tmp = xa_to_value(bitmap);
416 bitmap = alloc;
417 if (!bitmap)
418 bitmap = kzalloc(sizeof(*bitmap), GFP_NOWAIT);
419 if (!bitmap)
421 bitmap->bitmap[0] = tmp;
422 xas_store(&xas, bitmap);
424 bitmap->bitmap[0] = 0;
429 if (bitmap) {
430 bit = find_next_zero_bit(bitmap->bitmap, IDA_BITMAP_BITS, bit);
436 __set_bit(bit, bitmap->bitmap);
437 if (bitmap_full(bitmap->bitmap, IDA_BITMAP_BITS))
441 bitmap = xa_mk_value(1UL << bit);
443 bitmap = alloc;
444 if (!bitmap)
445 bitmap = kzalloc(sizeof(*bitmap), GFP_NOWAIT);
446 if (!bitmap)
448 __set_bit(bit, bitmap->bitmap);
450 xas_store(&xas, bitmap);
459 if (bitmap != alloc)
466 alloc = kzalloc(sizeof(*bitmap), gfp);
491 struct ida_bitmap *bitmap;
498 bitmap = xas_load(&xas);
500 if (xa_is_value(bitmap)) {
501 unsigned long v = xa_to_value(bitmap);
511 if (!bitmap || !test_bit(bit, bitmap->bitmap))
513 __clear_bit(bit, bitmap->bitmap);
515 if (bitmap_empty(bitmap->bitmap, IDA_BITMAP_BITS)) {
516 kfree(bitmap);
544 struct ida_bitmap *bitmap;
548 xas_for_each(&xas, bitmap, ULONG_MAX) {
549 if (!xa_is_value(bitmap))
550 kfree(bitmap);
582 struct ida_bitmap *bitmap = entry;
585 pr_cont("bitmap: %p data", bitmap);
587 pr_cont(" %lx", bitmap->bitmap[i]);