Lines Matching defs:bitmap
517 void *bitmap)
527 entry->type = (bitmap) ? BTRFS_FREE_SPACE_BITMAP :
546 static int io_ctl_add_bitmap(struct btrfs_io_ctl *io_ctl, void *bitmap)
562 copy_page(io_ctl->cur, bitmap);
622 copy_page(entry->bitmap, io_ctl->cur);
648 if (e->bitmap || prev->bitmap)
787 e->bitmap = kmem_cache_zalloc(
789 if (!e->bitmap) {
817 * the bitmap entries are added to the cache.
976 e->bitmap);
980 if (e->bitmap) {
1130 ret = io_ctl_add_bitmap(io_ctl, entry->bitmap);
1326 * or freeing the bitmap.
1466 struct rb_node *node, int bitmap)
1482 * we could have a bitmap entry and an extent entry
1487 * extent is faster than allocating from a bitmap. So
1488 * if we're inserting a bitmap and we find an entry at
1491 * found a bitmap, we want to go left, or before
1494 if (bitmap) {
1495 if (info->bitmap) {
1501 if (!info->bitmap) {
1551 if (entry->bitmap)
1555 * bitmap entry and extent entry may share same offset,
1556 * in that case, bitmap entry comes after extent entry.
1565 WARN_ON(!entry->bitmap);
1568 if (entry->bitmap) {
1571 * we should return it instead of the bitmap entry
1577 if (!prev->bitmap &&
1604 if (entry->bitmap) {
1609 if (!prev->bitmap &&
1622 if (entry->bitmap) {
1646 if (!info->bitmap && !btrfs_free_space_trimmed(info)) {
1664 ASSERT(info->bytes || info->bitmap);
1666 &info->offset_index, (info->bitmap != NULL));
1670 if (!info->bitmap && !btrfs_free_space_trimmed(info)) {
1730 bitmap_clear(info->bitmap, start, count);
1736 if (start && test_bit(start - 1, info->bitmap))
1739 if (end < BITS_PER_BITMAP && test_bit(end, info->bitmap))
1769 bitmap_set(info->bitmap, start, count);
1774 if (start && test_bit(start - 1, info->bitmap))
1777 if (end < BITS_PER_BITMAP && test_bit(end, info->bitmap))
1802 * Skip searching the bitmap if we don't have a contiguous section that
1816 for_each_set_bit_from(i, bitmap_info->bitmap, BITS_PER_BITMAP) {
1821 next_zero = find_next_zero_bit(bitmap_info->bitmap,
1846 if (entry->bitmap)
1896 if (entry->bitmap) {
1931 bitmap_for_each_set_region(bitmap_info->bitmap, rs, re, 0,
1960 * Normally when this is called, the bitmap is completely empty. However,
1972 kmem_cache_free(btrfs_free_space_bitmap_cachep, bitmap_info->bitmap);
1990 * We need to search for bits in this bitmap. We could only cover some
1991 * of the extent in this bitmap thanks to how we add space, so we need
2006 /* Cannot clear past the end of the bitmap */
2019 * no entry after this bitmap, but we still have bytes to
2029 * if the next entry isn't a bitmap we need to return to let the
2032 if (!bitmap_info->bitmap)
2036 * Ok the next item is a bitmap, but it may not actually hold
2063 * This is a tradeoff to make bitmap trim state minimal. We mark the
2064 * whole bitmap untrimmed if at any point we add untrimmed regions.
2109 * extent, and don't have to deal with the bitmap
2117 * the overhead of a bitmap if we don't have to.
2129 * megabytes, so don't bother with a bitmap for those entries. However
2130 * some block groups can be smaller than what a bitmap would cover but
2132 * so allow those block groups to still be allowed to have a bitmap
2168 * have a cluster here, and if so and it has our bitmap we need to add
2169 * the free space to that bitmap.
2187 if (!entry->bitmap) {
2226 if (info && info->bitmap) {
2245 /* allocate the bitmap */
2246 info->bitmap = kmem_cache_zalloc(btrfs_free_space_bitmap_cachep,
2250 if (!info->bitmap) {
2259 if (info->bitmap)
2261 info->bitmap);
2307 if (right_info && !right_info->bitmap &&
2319 if (left_info && !left_info->bitmap &&
2339 struct btrfs_free_space *bitmap;
2346 bitmap = tree_search_offset(ctl, bitmap_offset, 1, 0);
2347 if (!bitmap)
2350 i = offset_to_bit(bitmap->offset, ctl->unit, end);
2351 j = find_next_zero_bit(bitmap->bitmap, BITS_PER_BITMAP, i);
2358 if (!btrfs_free_space_trimmed(bitmap))
2362 bitmap_clear_bits(ctl, bitmap, end, bytes);
2364 __bitmap_clear_bits(ctl, bitmap, end, bytes);
2366 if (!bitmap->bytes)
2367 free_bitmap(ctl, bitmap);
2376 struct btrfs_free_space *bitmap;
2384 /* If we're on a boundary, try the previous logical bitmap. */
2391 bitmap = tree_search_offset(ctl, bitmap_offset, 1, 0);
2392 if (!bitmap)
2395 i = offset_to_bit(bitmap->offset, ctl->unit, info->offset) - 1;
2398 for_each_clear_bit_from(j, bitmap->bitmap, BITS_PER_BITMAP) {
2415 if (!btrfs_free_space_trimmed(bitmap))
2419 bitmap_clear_bits(ctl, bitmap, info->offset, bytes);
2421 __bitmap_clear_bits(ctl, bitmap, info->offset, bytes);
2423 if (!bitmap->bytes)
2424 free_bitmap(ctl, bitmap);
2432 * entry, try to see if there's adjacent free space in bitmap entries, and if
2437 * region (e.g. 1 extent entry + 1 bitmap entry starting where the extent entry
2448 ASSERT(!info->bitmap);
2492 * before we do that see if we need to drop this into a bitmap
2504 * going to add the new free space to existing bitmap entries - because
2583 * to remove, look for a bitmap instead
2590 * bitmap but then couldn't find the other part this may
2599 if (!info->bitmap) {
2671 btrfs_crit(fs_info, "entry offset %llu, bytes %llu, bitmap %s",
2673 (info->bitmap) ? "yes" : "no");
2729 bool bitmap;
2736 bitmap = (entry->bitmap != NULL);
2737 if (!bitmap) {
2756 entry->offset, &entry->offset_index, bitmap);
2771 if (!info->bitmap) {
2866 if (entry->bitmap) {
3008 (!entry->bitmap && entry->offset < min_start)) {
3017 if (entry->bitmap) {
3052 if (!entry->bitmap && !btrfs_free_space_trimmed(entry))
3059 if (entry->bitmap) {
3061 entry->bitmap);
3099 * Don't bother looking for a cluster in this bitmap if it's heavily
3107 for_each_set_bit_from(i, entry->bitmap, BITS_PER_BITMAP) {
3108 next_zero = find_next_zero_bit(entry->bitmap,
3180 while (entry->bitmap || entry->bytes < min_bytes) {
3181 if (entry->bitmap && list_empty(&entry->list))
3198 if (entry->bitmap) {
3229 if (entry->bitmap || entry->bytes < min_bytes)
3263 * The bitmap that covers offset won't be in the list unless offset
3481 while (entry->bitmap ||
3572 * If we break out of trimming a bitmap prematurely, we should reset the
3576 * start = start of bitmap
3577 * end = near end of bitmap
3649 * discarding of the same bitmap (the reason why we are bound
3664 * Async discard bitmap trimming begins at by setting the start
3666 * start of the bitmap. This lets us know we are fully
3667 * scanning the bitmap rather than only some portion of it.
3676 * We lossily consider a bitmap trimmed if we only skip
3784 /* If we ended in the middle of a bitmap, reset the trimming flag */
3843 * the tree, if the left-most item is a bitmap.
3859 if (!entry->bitmap) {
4004 * Use this if you need to make a bitmap or extent entry specifically, it
4010 u64 offset, u64 bytes, bool bitmap)
4026 if (!bitmap) {
4050 info->bitmap = map;
4096 if (info->bitmap) {