Lines Matching refs:bytes
37 u64 bytes; member
520 static int io_ctl_add_entry(struct btrfs_io_ctl *io_ctl, u64 offset, u64 bytes, in io_ctl_add_entry() argument
530 entry->bytes = cpu_to_le64(bytes); in io_ctl_add_entry()
604 entry->bytes = le64_to_cpu(e->bytes); in io_ctl_read_entry()
654 if (prev->offset + prev->bytes == e->offset) { in merge_space_tree()
657 prev->bytes += e->bytes; in merge_space_tree()
762 if (!e->bytes) { in __load_free_space_cache()
938 ret = io_ctl_add_entry(io_ctl, e->offset, e->bytes, in write_cache_extent_entries()
968 trim_entry->bytes, NULL); in write_cache_extent_entries()
1417 static inline unsigned long bytes_to_bits(u64 bytes, u32 unit) in bytes_to_bits() argument
1419 return (unsigned long)(div_u64(bytes, unit)); in bytes_to_bits()
1550 prev->offset + prev->bytes > offset) in tree_search_offset()
1582 prev->offset + prev->bytes > offset) in tree_search_offset()
1587 } else if (entry->offset + entry->bytes > offset) in tree_search_offset()
1599 if (entry->offset + entry->bytes > offset) in tree_search_offset()
1623 ctl->free_space -= info->bytes; in unlink_free_space()
1631 ASSERT(info->bytes || info->bitmap); in link_free_space()
1637 ctl->free_space += info->bytes; in link_free_space()
1692 u64 offset, u64 bytes) in __bitmap_clear_bits() argument
1697 count = bytes_to_bits(bytes, ctl->unit); in __bitmap_clear_bits()
1702 info->bytes -= bytes; in __bitmap_clear_bits()
1707 u64 bytes) in bitmap_clear_bits() argument
1709 __bitmap_clear_bits(ctl, info, offset, bytes); in bitmap_clear_bits()
1710 ctl->free_space -= bytes; in bitmap_clear_bits()
1715 u64 bytes) in bitmap_set_bits() argument
1720 count = bytes_to_bits(bytes, ctl->unit); in bitmap_set_bits()
1725 info->bytes += bytes; in bitmap_set_bits()
1726 ctl->free_space += bytes; in bitmap_set_bits()
1735 u64 *bytes) in search_bitmap() argument
1745 bits = bytes_to_bits(*bytes, ctl->unit); in search_bitmap()
1762 *bytes = (u64)(found_bits) * ctl->unit; in search_bitmap()
1766 *bytes = (u64)(max_bits) * ctl->unit; in search_bitmap()
1772 find_free_space(struct btrfs_free_space_ctl *ctl, u64 *offset, u64 *bytes, in find_free_space() argument
1790 if (entry->bytes < *bytes) { in find_free_space()
1791 if (entry->bytes > *max_extent_size) in find_free_space()
1792 *max_extent_size = entry->bytes; in find_free_space()
1799 if (*bytes >= align) { in find_free_space()
1809 if (entry->bytes < *bytes + align_off) { in find_free_space()
1810 if (entry->bytes > *max_extent_size) in find_free_space()
1811 *max_extent_size = entry->bytes; in find_free_space()
1816 u64 size = *bytes; in find_free_space()
1821 *bytes = size; in find_free_space()
1830 *bytes = entry->bytes - align_off; in find_free_space()
1841 info->bytes = 0; in add_new_bitmap()
1861 u64 *offset, u64 *bytes) in remove_from_bitmap() argument
1884 search_bytes = min(search_bytes, *bytes); in remove_from_bitmap()
1891 *bytes -= search_bytes; in remove_from_bitmap()
1893 if (*bytes) { in remove_from_bitmap()
1895 if (!bitmap_info->bytes) in remove_from_bitmap()
1929 } else if (!bitmap_info->bytes) in remove_from_bitmap()
1937 u64 bytes) in add_bytes_to_bitmap() argument
1944 bytes_to_set = min(end - offset, bytes); in add_bytes_to_bitmap()
1969 if (info->bytes <= block_group->sectorsize * 4) { in use_bitmap()
2002 u64 bytes, offset, bytes_added; in insert_into_bitmap() local
2005 bytes = info->bytes; in insert_into_bitmap()
2042 offset, bytes); in insert_into_bitmap()
2043 bytes -= bytes_added; in insert_into_bitmap()
2047 if (!bytes) { in insert_into_bitmap()
2061 bytes_added = add_bytes_to_bitmap(ctl, bitmap_info, offset, bytes); in insert_into_bitmap()
2062 bytes -= bytes_added; in insert_into_bitmap()
2066 if (!bytes) { in insert_into_bitmap()
2119 u64 bytes = info->bytes; in try_merge_free_space() local
2126 right_info = tree_search_offset(ctl, offset + bytes, 0, 0); in try_merge_free_space()
2138 info->bytes += right_info->bytes; in try_merge_free_space()
2144 left_info->offset + left_info->bytes == offset) { in try_merge_free_space()
2150 info->bytes += left_info->bytes; in try_merge_free_space()
2165 const u64 end = info->offset + info->bytes; in steal_from_bitmap_to_end()
2167 u64 bytes; in steal_from_bitmap_to_end() local
2177 bytes = (j - i) * ctl->unit; in steal_from_bitmap_to_end()
2178 info->bytes += bytes; in steal_from_bitmap_to_end()
2181 bitmap_clear_bits(ctl, bitmap, end, bytes); in steal_from_bitmap_to_end()
2183 __bitmap_clear_bits(ctl, bitmap, end, bytes); in steal_from_bitmap_to_end()
2185 if (!bitmap->bytes) in steal_from_bitmap_to_end()
2200 u64 bytes; in steal_from_bitmap_to_front() local
2226 bytes = (i + 1) * ctl->unit; in steal_from_bitmap_to_front()
2228 bytes = (i - prev_j) * ctl->unit; in steal_from_bitmap_to_front()
2230 info->offset -= bytes; in steal_from_bitmap_to_front()
2231 info->bytes += bytes; in steal_from_bitmap_to_front()
2234 bitmap_clear_bits(ctl, bitmap, info->offset, bytes); in steal_from_bitmap_to_front()
2236 __bitmap_clear_bits(ctl, bitmap, info->offset, bytes); in steal_from_bitmap_to_front()
2238 if (!bitmap->bytes) in steal_from_bitmap_to_front()
2281 u64 offset, u64 bytes) in __btrfs_add_free_space() argument
2291 info->bytes = bytes; in __btrfs_add_free_space()
2335 u64 offset, u64 bytes) in btrfs_remove_free_space() argument
2346 if (!bytes) in btrfs_remove_free_space()
2372 u64 to_free = min(bytes, info->bytes); in btrfs_remove_free_space()
2374 info->bytes -= to_free; in btrfs_remove_free_space()
2376 if (info->bytes) { in btrfs_remove_free_space()
2384 bytes -= to_free; in btrfs_remove_free_space()
2387 u64 old_end = info->bytes + info->offset; in btrfs_remove_free_space()
2389 info->bytes = offset - info->offset; in btrfs_remove_free_space()
2396 if (old_end < offset + bytes) { in btrfs_remove_free_space()
2397 bytes -= old_end - offset; in btrfs_remove_free_space()
2400 } else if (old_end == offset + bytes) { in btrfs_remove_free_space()
2406 ret = btrfs_add_free_space(block_group, offset + bytes, in btrfs_remove_free_space()
2407 old_end - (offset + bytes)); in btrfs_remove_free_space()
2413 ret = remove_from_bitmap(ctl, info, &offset, &bytes); in btrfs_remove_free_space()
2425 u64 bytes) in btrfs_dump_free_space() argument
2434 if (info->bytes >= bytes && !block_group->ro) in btrfs_dump_free_space()
2438 info->offset, info->bytes, in btrfs_dump_free_space()
2565 u64 offset, u64 bytes, u64 empty_size, in btrfs_find_space_for_alloc() argument
2570 u64 bytes_search = bytes + empty_size; in btrfs_find_space_for_alloc()
2583 bitmap_clear_bits(ctl, entry, offset, bytes); in btrfs_find_space_for_alloc()
2584 if (!entry->bytes) in btrfs_find_space_for_alloc()
2591 entry->offset = offset + bytes; in btrfs_find_space_for_alloc()
2592 WARN_ON(entry->bytes < bytes + align_gap_len); in btrfs_find_space_for_alloc()
2594 entry->bytes -= bytes + align_gap_len; in btrfs_find_space_for_alloc()
2595 if (!entry->bytes) in btrfs_find_space_for_alloc()
2654 u64 bytes, u64 min_start, in btrfs_alloc_from_bitmap() argument
2660 u64 search_bytes = bytes; in btrfs_alloc_from_bitmap()
2664 search_bytes = bytes; in btrfs_alloc_from_bitmap()
2674 __bitmap_clear_bits(ctl, entry, ret, bytes); in btrfs_alloc_from_bitmap()
2685 struct btrfs_free_cluster *cluster, u64 bytes, in btrfs_alloc_from_cluster() argument
2694 if (bytes > cluster->max_size) in btrfs_alloc_from_cluster()
2706 if (entry->bytes < bytes && entry->bytes > *max_extent_size) in btrfs_alloc_from_cluster()
2707 *max_extent_size = entry->bytes; in btrfs_alloc_from_cluster()
2709 if (entry->bytes < bytes || in btrfs_alloc_from_cluster()
2721 cluster, entry, bytes, in btrfs_alloc_from_cluster()
2732 cluster->window_start += bytes; in btrfs_alloc_from_cluster()
2736 entry->offset += bytes; in btrfs_alloc_from_cluster()
2737 entry->bytes -= bytes; in btrfs_alloc_from_cluster()
2740 if (entry->bytes == 0) in btrfs_alloc_from_cluster()
2752 ctl->free_space -= bytes; in btrfs_alloc_from_cluster()
2753 if (entry->bytes == 0) { in btrfs_alloc_from_cluster()
2771 u64 offset, u64 bytes, in btrfs_bitmap_cluster() argument
2786 want_bits = bytes_to_bits(bytes, ctl->unit); in btrfs_bitmap_cluster()
2838 struct list_head *bitmaps, u64 offset, u64 bytes, in setup_cluster_no_bitmap() argument
2858 while (entry->bitmap || entry->bytes < min_bytes) { in setup_cluster_no_bitmap()
2867 window_free = entry->bytes; in setup_cluster_no_bitmap()
2868 max_extent = entry->bytes; in setup_cluster_no_bitmap()
2882 if (entry->bytes < min_bytes) in setup_cluster_no_bitmap()
2886 window_free += entry->bytes; in setup_cluster_no_bitmap()
2887 if (entry->bytes > max_extent) in setup_cluster_no_bitmap()
2888 max_extent = entry->bytes; in setup_cluster_no_bitmap()
2891 if (window_free < bytes || max_extent < cont1_bytes) in setup_cluster_no_bitmap()
2907 if (entry->bitmap || entry->bytes < min_bytes) in setup_cluster_no_bitmap()
2913 total_size += entry->bytes; in setup_cluster_no_bitmap()
2929 struct list_head *bitmaps, u64 offset, u64 bytes, in setup_cluster_bitmap() argument
2952 if (entry->bytes < bytes) in setup_cluster_bitmap()
2955 bytes, cont1_bytes, min_bytes); in setup_cluster_bitmap()
2978 u64 offset, u64 bytes, u64 empty_size) in btrfs_find_space_cluster() argument
2994 cont1_bytes = min_bytes = bytes + empty_size; in btrfs_find_space_cluster()
2996 cont1_bytes = bytes; in btrfs_find_space_cluster()
2999 cont1_bytes = max(bytes, (bytes + empty_size) >> 2); in btrfs_find_space_cluster()
3009 if (ctl->free_space < bytes) { in btrfs_find_space_cluster()
3022 trace_btrfs_find_cluster(block_group, offset, bytes, empty_size, in btrfs_find_space_cluster()
3026 bytes + empty_size, in btrfs_find_space_cluster()
3030 offset, bytes + empty_size, in btrfs_find_space_cluster()
3066 u64 *total_trimmed, u64 start, u64 bytes, in do_trimming() argument
3088 start, bytes, &trimmed); in do_trimming()
3120 u64 bytes; in trim_no_bitmap() local
3160 extent_bytes = entry->bytes; in trim_no_bitmap()
3162 bytes = min(extent_start + extent_bytes, end) - start; in trim_no_bitmap()
3163 if (bytes < minlen) { in trim_no_bitmap()
3174 trim_entry.bytes = extent_bytes; in trim_no_bitmap()
3178 ret = do_trimming(block_group, total_trimmed, start, bytes, in trim_no_bitmap()
3183 start += bytes; in trim_no_bitmap()
3203 u64 bytes; in trim_bitmaps() local
3227 bytes = minlen; in trim_bitmaps()
3228 ret2 = search_bitmap(ctl, entry, &start, &bytes); in trim_bitmaps()
3236 bytes = min(bytes, end - start); in trim_bitmaps()
3237 if (bytes < minlen) { in trim_bitmaps()
3243 bitmap_clear_bits(ctl, entry, start, bytes); in trim_bitmaps()
3244 if (entry->bytes == 0) in trim_bitmaps()
3249 trim_entry.bytes = bytes; in trim_bitmaps()
3253 ret = do_trimming(block_group, total_trimmed, start, bytes, in trim_bitmaps()
3254 start, bytes, &trim_entry); in trim_bitmaps()
3261 start += bytes; in trim_bitmaps()
3362 entry->bytes--; in btrfs_find_ino_for_alloc()
3363 if (!entry->bytes) in btrfs_find_ino_for_alloc()
3378 if (entry->bytes == 0) in btrfs_find_ino_for_alloc()
3509 u64 offset, u64 bytes, bool bitmap) in test_add_free_space_entry() argument
3527 info->bytes = bytes; in test_add_free_space_entry()
3554 bytes_added = add_bytes_to_bitmap(ctl, bitmap_info, offset, bytes); in test_add_free_space_entry()
3555 bytes -= bytes_added; in test_add_free_space_entry()
3559 if (bytes) in test_add_free_space_entry()
3575 u64 offset, u64 bytes) in test_check_exists() argument
3604 offset + bytes > bit_off) { in test_check_exists()
3614 if (tmp->offset + tmp->bytes < offset) in test_check_exists()
3616 if (offset + bytes < tmp->offset) { in test_check_exists()
3628 if (offset + bytes < tmp->offset) in test_check_exists()
3630 if (tmp->offset + tmp->bytes < offset) { in test_check_exists()
3647 if (offset > info->offset && offset < info->offset + info->bytes) in test_check_exists()