Lines Matching refs:bytes

37 	u64 bytes;  member
518 static int io_ctl_add_entry(struct btrfs_io_ctl *io_ctl, u64 offset, u64 bytes, in io_ctl_add_entry() argument
528 entry->bytes = cpu_to_le64(bytes); in io_ctl_add_entry()
602 entry->bytes = le64_to_cpu(e->bytes); in io_ctl_read_entry()
652 if (prev->offset + prev->bytes == e->offset) { in merge_space_tree()
655 prev->bytes += e->bytes; in merge_space_tree()
760 if (!e->bytes) { in __load_free_space_cache()
936 ret = io_ctl_add_entry(io_ctl, e->offset, e->bytes, in write_cache_extent_entries()
966 trim_entry->bytes, NULL); in write_cache_extent_entries()
1415 static inline unsigned long bytes_to_bits(u64 bytes, u32 unit) in bytes_to_bits() argument
1417 return (unsigned long)(div_u64(bytes, unit)); in bytes_to_bits()
1548 prev->offset + prev->bytes > offset) in tree_search_offset()
1580 prev->offset + prev->bytes > offset) in tree_search_offset()
1585 } else if (entry->offset + entry->bytes > offset) in tree_search_offset()
1597 if (entry->offset + entry->bytes > offset) in tree_search_offset()
1621 ctl->free_space -= info->bytes; in unlink_free_space()
1629 ASSERT(info->bytes || info->bitmap); in link_free_space()
1635 ctl->free_space += info->bytes; in link_free_space()
1690 u64 offset, u64 bytes) in __bitmap_clear_bits() argument
1695 count = bytes_to_bits(bytes, ctl->unit); in __bitmap_clear_bits()
1700 info->bytes -= bytes; in __bitmap_clear_bits()
1705 u64 bytes) in bitmap_clear_bits() argument
1707 __bitmap_clear_bits(ctl, info, offset, bytes); in bitmap_clear_bits()
1708 ctl->free_space -= bytes; in bitmap_clear_bits()
1713 u64 bytes) in bitmap_set_bits() argument
1718 count = bytes_to_bits(bytes, ctl->unit); in bitmap_set_bits()
1723 info->bytes += bytes; in bitmap_set_bits()
1724 ctl->free_space += bytes; in bitmap_set_bits()
1733 u64 *bytes, bool for_alloc) in search_bitmap() argument
1747 bitmap_info->max_extent_size < *bytes) { in search_bitmap()
1748 *bytes = bitmap_info->max_extent_size; in search_bitmap()
1754 bits = bytes_to_bits(*bytes, ctl->unit); in search_bitmap()
1775 *bytes = (u64)(found_bits) * ctl->unit; in search_bitmap()
1779 *bytes = (u64)(max_bits) * ctl->unit; in search_bitmap()
1780 bitmap_info->max_extent_size = *bytes; in search_bitmap()
1786 find_free_space(struct btrfs_free_space_ctl *ctl, u64 *offset, u64 *bytes, in find_free_space() argument
1804 if (entry->bytes < *bytes) { in find_free_space()
1805 if (entry->bytes > *max_extent_size) in find_free_space()
1806 *max_extent_size = entry->bytes; in find_free_space()
1813 if (*bytes >= align) { in find_free_space()
1823 if (entry->bytes < *bytes + align_off) { in find_free_space()
1824 if (entry->bytes > *max_extent_size) in find_free_space()
1825 *max_extent_size = entry->bytes; in find_free_space()
1830 u64 size = *bytes; in find_free_space()
1835 *bytes = size; in find_free_space()
1844 *bytes = entry->bytes - align_off; in find_free_space()
1855 info->bytes = 0; in add_new_bitmap()
1875 u64 *offset, u64 *bytes) in remove_from_bitmap() argument
1899 search_bytes = min(search_bytes, *bytes); in remove_from_bitmap()
1906 *bytes -= search_bytes; in remove_from_bitmap()
1908 if (*bytes) { in remove_from_bitmap()
1910 if (!bitmap_info->bytes) in remove_from_bitmap()
1944 } else if (!bitmap_info->bytes) in remove_from_bitmap()
1952 u64 bytes) in add_bytes_to_bitmap() argument
1959 bytes_to_set = min(end - offset, bytes); in add_bytes_to_bitmap()
1997 if (info->bytes <= block_group->sectorsize * 4) { in use_bitmap()
2030 u64 bytes, offset, bytes_added; in insert_into_bitmap() local
2033 bytes = info->bytes; in insert_into_bitmap()
2070 offset, bytes); in insert_into_bitmap()
2071 bytes -= bytes_added; in insert_into_bitmap()
2075 if (!bytes) { in insert_into_bitmap()
2089 bytes_added = add_bytes_to_bitmap(ctl, bitmap_info, offset, bytes); in insert_into_bitmap()
2090 bytes -= bytes_added; in insert_into_bitmap()
2094 if (!bytes) { in insert_into_bitmap()
2147 u64 bytes = info->bytes; in try_merge_free_space() local
2154 right_info = tree_search_offset(ctl, offset + bytes, 0, 0); in try_merge_free_space()
2166 info->bytes += right_info->bytes; in try_merge_free_space()
2172 left_info->offset + left_info->bytes == offset) { in try_merge_free_space()
2178 info->bytes += left_info->bytes; in try_merge_free_space()
2193 const u64 end = info->offset + info->bytes; in steal_from_bitmap_to_end()
2195 u64 bytes; in steal_from_bitmap_to_end() local
2205 bytes = (j - i) * ctl->unit; in steal_from_bitmap_to_end()
2206 info->bytes += bytes; in steal_from_bitmap_to_end()
2209 bitmap_clear_bits(ctl, bitmap, end, bytes); in steal_from_bitmap_to_end()
2211 __bitmap_clear_bits(ctl, bitmap, end, bytes); in steal_from_bitmap_to_end()
2213 if (!bitmap->bytes) in steal_from_bitmap_to_end()
2228 u64 bytes; in steal_from_bitmap_to_front() local
2254 bytes = (i + 1) * ctl->unit; in steal_from_bitmap_to_front()
2256 bytes = (i - prev_j) * ctl->unit; in steal_from_bitmap_to_front()
2258 info->offset -= bytes; in steal_from_bitmap_to_front()
2259 info->bytes += bytes; in steal_from_bitmap_to_front()
2262 bitmap_clear_bits(ctl, bitmap, info->offset, bytes); in steal_from_bitmap_to_front()
2264 __bitmap_clear_bits(ctl, bitmap, info->offset, bytes); in steal_from_bitmap_to_front()
2266 if (!bitmap->bytes) in steal_from_bitmap_to_front()
2309 u64 offset, u64 bytes) in __btrfs_add_free_space() argument
2319 info->bytes = bytes; in __btrfs_add_free_space()
2363 u64 offset, u64 bytes) in btrfs_remove_free_space() argument
2374 if (!bytes) in btrfs_remove_free_space()
2400 u64 to_free = min(bytes, info->bytes); in btrfs_remove_free_space()
2402 info->bytes -= to_free; in btrfs_remove_free_space()
2404 if (info->bytes) { in btrfs_remove_free_space()
2412 bytes -= to_free; in btrfs_remove_free_space()
2415 u64 old_end = info->bytes + info->offset; in btrfs_remove_free_space()
2417 info->bytes = offset - info->offset; in btrfs_remove_free_space()
2424 if (old_end < offset + bytes) { in btrfs_remove_free_space()
2425 bytes -= old_end - offset; in btrfs_remove_free_space()
2428 } else if (old_end == offset + bytes) { in btrfs_remove_free_space()
2434 ret = btrfs_add_free_space(block_group, offset + bytes, in btrfs_remove_free_space()
2435 old_end - (offset + bytes)); in btrfs_remove_free_space()
2441 ret = remove_from_bitmap(ctl, info, &offset, &bytes); in btrfs_remove_free_space()
2453 u64 bytes) in btrfs_dump_free_space() argument
2462 if (info->bytes >= bytes && !block_group->ro) in btrfs_dump_free_space()
2466 info->offset, info->bytes, in btrfs_dump_free_space()
2593 u64 offset, u64 bytes, u64 empty_size, in btrfs_find_space_for_alloc() argument
2598 u64 bytes_search = bytes + empty_size; in btrfs_find_space_for_alloc()
2611 bitmap_clear_bits(ctl, entry, offset, bytes); in btrfs_find_space_for_alloc()
2612 if (!entry->bytes) in btrfs_find_space_for_alloc()
2619 entry->offset = offset + bytes; in btrfs_find_space_for_alloc()
2620 WARN_ON(entry->bytes < bytes + align_gap_len); in btrfs_find_space_for_alloc()
2622 entry->bytes -= bytes + align_gap_len; in btrfs_find_space_for_alloc()
2623 if (!entry->bytes) in btrfs_find_space_for_alloc()
2682 u64 bytes, u64 min_start, in btrfs_alloc_from_bitmap() argument
2688 u64 search_bytes = bytes; in btrfs_alloc_from_bitmap()
2692 search_bytes = bytes; in btrfs_alloc_from_bitmap()
2702 __bitmap_clear_bits(ctl, entry, ret, bytes); in btrfs_alloc_from_bitmap()
2713 struct btrfs_free_cluster *cluster, u64 bytes, in btrfs_alloc_from_cluster() argument
2722 if (bytes > cluster->max_size) in btrfs_alloc_from_cluster()
2734 if (entry->bytes < bytes && entry->bytes > *max_extent_size) in btrfs_alloc_from_cluster()
2735 *max_extent_size = entry->bytes; in btrfs_alloc_from_cluster()
2737 if (entry->bytes < bytes || in btrfs_alloc_from_cluster()
2749 cluster, entry, bytes, in btrfs_alloc_from_cluster()
2760 cluster->window_start += bytes; in btrfs_alloc_from_cluster()
2764 entry->offset += bytes; in btrfs_alloc_from_cluster()
2765 entry->bytes -= bytes; in btrfs_alloc_from_cluster()
2768 if (entry->bytes == 0) in btrfs_alloc_from_cluster()
2780 ctl->free_space -= bytes; in btrfs_alloc_from_cluster()
2781 if (entry->bytes == 0) { in btrfs_alloc_from_cluster()
2799 u64 offset, u64 bytes, in btrfs_bitmap_cluster() argument
2815 want_bits = bytes_to_bits(bytes, ctl->unit); in btrfs_bitmap_cluster()
2880 struct list_head *bitmaps, u64 offset, u64 bytes, in setup_cluster_no_bitmap() argument
2900 while (entry->bitmap || entry->bytes < min_bytes) { in setup_cluster_no_bitmap()
2909 window_free = entry->bytes; in setup_cluster_no_bitmap()
2910 max_extent = entry->bytes; in setup_cluster_no_bitmap()
2924 if (entry->bytes < min_bytes) in setup_cluster_no_bitmap()
2928 window_free += entry->bytes; in setup_cluster_no_bitmap()
2929 if (entry->bytes > max_extent) in setup_cluster_no_bitmap()
2930 max_extent = entry->bytes; in setup_cluster_no_bitmap()
2933 if (window_free < bytes || max_extent < cont1_bytes) in setup_cluster_no_bitmap()
2949 if (entry->bitmap || entry->bytes < min_bytes) in setup_cluster_no_bitmap()
2955 total_size += entry->bytes; in setup_cluster_no_bitmap()
2971 struct list_head *bitmaps, u64 offset, u64 bytes, in setup_cluster_bitmap() argument
2996 if (entry->bytes < bytes) in setup_cluster_bitmap()
2999 bytes, cont1_bytes, min_bytes); in setup_cluster_bitmap()
3022 u64 offset, u64 bytes, u64 empty_size) in btrfs_find_space_cluster() argument
3038 cont1_bytes = min_bytes = bytes + empty_size; in btrfs_find_space_cluster()
3040 cont1_bytes = bytes; in btrfs_find_space_cluster()
3043 cont1_bytes = max(bytes, (bytes + empty_size) >> 2); in btrfs_find_space_cluster()
3053 if (ctl->free_space < bytes) { in btrfs_find_space_cluster()
3066 trace_btrfs_find_cluster(block_group, offset, bytes, empty_size, in btrfs_find_space_cluster()
3070 bytes + empty_size, in btrfs_find_space_cluster()
3074 offset, bytes + empty_size, in btrfs_find_space_cluster()
3111 u64 *total_trimmed, u64 start, u64 bytes, in do_trimming() argument
3133 start, bytes, &trimmed); in do_trimming()
3165 u64 bytes; in trim_no_bitmap() local
3205 extent_bytes = entry->bytes; in trim_no_bitmap()
3207 bytes = min(extent_start + extent_bytes, end) - start; in trim_no_bitmap()
3208 if (bytes < minlen) { in trim_no_bitmap()
3219 trim_entry.bytes = extent_bytes; in trim_no_bitmap()
3223 ret = do_trimming(block_group, total_trimmed, start, bytes, in trim_no_bitmap()
3228 start += bytes; in trim_no_bitmap()
3248 u64 bytes; in trim_bitmaps() local
3272 bytes = minlen; in trim_bitmaps()
3273 ret2 = search_bitmap(ctl, entry, &start, &bytes, false); in trim_bitmaps()
3281 bytes = min(bytes, end - start); in trim_bitmaps()
3282 if (bytes < minlen) { in trim_bitmaps()
3288 bitmap_clear_bits(ctl, entry, start, bytes); in trim_bitmaps()
3289 if (entry->bytes == 0) in trim_bitmaps()
3294 trim_entry.bytes = bytes; in trim_bitmaps()
3298 ret = do_trimming(block_group, total_trimmed, start, bytes, in trim_bitmaps()
3299 start, bytes, &trim_entry); in trim_bitmaps()
3306 start += bytes; in trim_bitmaps()
3416 entry->bytes--; in btrfs_find_ino_for_alloc()
3417 if (!entry->bytes) in btrfs_find_ino_for_alloc()
3432 if (entry->bytes == 0) in btrfs_find_ino_for_alloc()
3563 u64 offset, u64 bytes, bool bitmap) in test_add_free_space_entry() argument
3581 info->bytes = bytes; in test_add_free_space_entry()
3609 bytes_added = add_bytes_to_bitmap(ctl, bitmap_info, offset, bytes); in test_add_free_space_entry()
3611 bytes -= bytes_added; in test_add_free_space_entry()
3615 if (bytes) in test_add_free_space_entry()
3631 u64 offset, u64 bytes) in test_check_exists() argument
3660 offset + bytes > bit_off) { in test_check_exists()
3670 if (tmp->offset + tmp->bytes < offset) in test_check_exists()
3672 if (offset + bytes < tmp->offset) { in test_check_exists()
3684 if (offset + bytes < tmp->offset) in test_check_exists()
3686 if (tmp->offset + tmp->bytes < offset) { in test_check_exists()
3703 if (offset > info->offset && offset < info->offset + info->bytes) in test_check_exists()