Lines Matching refs:bytes
478 static int io_ctl_add_entry(struct io_ctl *io_ctl, u64 offset, u64 bytes, in io_ctl_add_entry() argument
488 entry->bytes = cpu_to_le64(bytes); in io_ctl_add_entry()
562 entry->bytes = le64_to_cpu(e->bytes); in io_ctl_read_entry()
612 if (prev->offset + prev->bytes == e->offset) { in merge_space_tree()
615 prev->bytes += e->bytes; in merge_space_tree()
716 if (!e->bytes) { in __load_free_space_cache()
934 ret = io_ctl_add_entry(&io_ctl, e->offset, e->bytes, in __btrfs_write_out_cache()
1125 static inline unsigned long bytes_to_bits(u64 bytes, u32 unit) in bytes_to_bits() argument
1127 return (unsigned long)(div_u64(bytes, unit)); in bytes_to_bits()
1258 prev->offset + prev->bytes > offset) in tree_search_offset()
1290 prev->offset + prev->bytes > offset) in tree_search_offset()
1295 } else if (entry->offset + entry->bytes > offset) in tree_search_offset()
1307 if (entry->offset + entry->bytes > offset) in tree_search_offset()
1331 ctl->free_space -= info->bytes; in unlink_free_space()
1339 BUG_ON(!info->bitmap && !info->bytes); in link_free_space()
1345 ctl->free_space += info->bytes; in link_free_space()
1400 u64 offset, u64 bytes) in __bitmap_clear_bits() argument
1405 count = bytes_to_bits(bytes, ctl->unit); in __bitmap_clear_bits()
1410 info->bytes -= bytes; in __bitmap_clear_bits()
1415 u64 bytes) in bitmap_clear_bits() argument
1417 __bitmap_clear_bits(ctl, info, offset, bytes); in bitmap_clear_bits()
1418 ctl->free_space -= bytes; in bitmap_clear_bits()
1423 u64 bytes) in bitmap_set_bits() argument
1428 count = bytes_to_bits(bytes, ctl->unit); in bitmap_set_bits()
1433 info->bytes += bytes; in bitmap_set_bits()
1434 ctl->free_space += bytes; in bitmap_set_bits()
1439 u64 *bytes) in search_bitmap() argument
1447 bits = bytes_to_bits(*bytes, ctl->unit); in search_bitmap()
1461 *bytes = (u64)(found_bits) * ctl->unit; in search_bitmap()
1469 find_free_space(struct btrfs_free_space_ctl *ctl, u64 *offset, u64 *bytes, in find_free_space() argument
1488 if (entry->bytes < *bytes) in find_free_space()
1494 if (*bytes >= align) { in find_free_space()
1505 if (entry->bytes < *bytes + align_off) in find_free_space()
1509 ret = search_bitmap(ctl, entry, &tmp, bytes); in find_free_space()
1518 *bytes = entry->bytes - align_off; in find_free_space()
1529 info->bytes = 0; in add_new_bitmap()
1549 u64 *offset, u64 *bytes) in remove_from_bitmap() argument
1572 search_bytes = min(search_bytes, *bytes); in remove_from_bitmap()
1579 *bytes -= search_bytes; in remove_from_bitmap()
1581 if (*bytes) { in remove_from_bitmap()
1583 if (!bitmap_info->bytes) in remove_from_bitmap()
1617 } else if (!bitmap_info->bytes) in remove_from_bitmap()
1625 u64 bytes) in add_bytes_to_bitmap() argument
1632 bytes_to_set = min(end - offset, bytes); in add_bytes_to_bitmap()
1657 if (info->bytes <= block_group->sectorsize * 4) { in use_bitmap()
1690 u64 bytes, offset, bytes_added; in insert_into_bitmap() local
1693 bytes = info->bytes; in insert_into_bitmap()
1730 offset, bytes); in insert_into_bitmap()
1731 bytes -= bytes_added; in insert_into_bitmap()
1735 if (!bytes) { in insert_into_bitmap()
1749 bytes_added = add_bytes_to_bitmap(ctl, bitmap_info, offset, bytes); in insert_into_bitmap()
1750 bytes -= bytes_added; in insert_into_bitmap()
1754 if (!bytes) { in insert_into_bitmap()
1807 u64 bytes = info->bytes; in try_merge_free_space() local
1814 right_info = tree_search_offset(ctl, offset + bytes, 0, 0); in try_merge_free_space()
1826 info->bytes += right_info->bytes; in try_merge_free_space()
1832 left_info->offset + left_info->bytes == offset) { in try_merge_free_space()
1838 info->bytes += left_info->bytes; in try_merge_free_space()
1847 u64 offset, u64 bytes) in __btrfs_add_free_space() argument
1857 info->bytes = bytes; in __btrfs_add_free_space()
1892 u64 offset, u64 bytes) in btrfs_remove_free_space() argument
1903 if (!bytes) in btrfs_remove_free_space()
1929 u64 to_free = min(bytes, info->bytes); in btrfs_remove_free_space()
1931 info->bytes -= to_free; in btrfs_remove_free_space()
1933 if (info->bytes) { in btrfs_remove_free_space()
1941 bytes -= to_free; in btrfs_remove_free_space()
1944 u64 old_end = info->bytes + info->offset; in btrfs_remove_free_space()
1946 info->bytes = offset - info->offset; in btrfs_remove_free_space()
1953 if (old_end < offset + bytes) { in btrfs_remove_free_space()
1954 bytes -= old_end - offset; in btrfs_remove_free_space()
1957 } else if (old_end == offset + bytes) { in btrfs_remove_free_space()
1963 ret = btrfs_add_free_space(block_group, offset + bytes, in btrfs_remove_free_space()
1964 old_end - (offset + bytes)); in btrfs_remove_free_space()
1970 ret = remove_from_bitmap(ctl, info, &offset, &bytes); in btrfs_remove_free_space()
1982 u64 bytes) in btrfs_dump_free_space() argument
1991 if (info->bytes >= bytes && !block_group->ro) in btrfs_dump_free_space()
1995 (unsigned long long)info->bytes, in btrfs_dump_free_space()
2123 u64 offset, u64 bytes, u64 empty_size) in btrfs_find_space_for_alloc() argument
2127 u64 bytes_search = bytes + empty_size; in btrfs_find_space_for_alloc()
2140 bitmap_clear_bits(ctl, entry, offset, bytes); in btrfs_find_space_for_alloc()
2141 if (!entry->bytes) in btrfs_find_space_for_alloc()
2149 entry->offset = offset + bytes; in btrfs_find_space_for_alloc()
2150 WARN_ON(entry->bytes < bytes + align_gap_len); in btrfs_find_space_for_alloc()
2152 entry->bytes -= bytes + align_gap_len; in btrfs_find_space_for_alloc()
2153 if (!entry->bytes) in btrfs_find_space_for_alloc()
2213 u64 bytes, u64 min_start) in btrfs_alloc_from_bitmap() argument
2218 u64 search_bytes = bytes; in btrfs_alloc_from_bitmap()
2222 search_bytes = bytes; in btrfs_alloc_from_bitmap()
2229 __bitmap_clear_bits(ctl, entry, ret, bytes); in btrfs_alloc_from_bitmap()
2240 struct btrfs_free_cluster *cluster, u64 bytes, in btrfs_alloc_from_cluster() argument
2249 if (bytes > cluster->max_size) in btrfs_alloc_from_cluster()
2261 if (entry->bytes < bytes || in btrfs_alloc_from_cluster()
2273 cluster, entry, bytes, in btrfs_alloc_from_cluster()
2283 cluster->window_start += bytes; in btrfs_alloc_from_cluster()
2287 entry->offset += bytes; in btrfs_alloc_from_cluster()
2288 entry->bytes -= bytes; in btrfs_alloc_from_cluster()
2291 if (entry->bytes == 0) in btrfs_alloc_from_cluster()
2303 ctl->free_space -= bytes; in btrfs_alloc_from_cluster()
2304 if (entry->bytes == 0) { in btrfs_alloc_from_cluster()
2322 u64 offset, u64 bytes, in btrfs_bitmap_cluster() argument
2337 want_bits = bytes_to_bits(bytes, ctl->unit); in btrfs_bitmap_cluster()
2389 struct list_head *bitmaps, u64 offset, u64 bytes, in setup_cluster_no_bitmap() argument
2410 while (entry->bitmap || entry->bytes < min_bytes) { in setup_cluster_no_bitmap()
2420 window_free = entry->bytes; in setup_cluster_no_bitmap()
2421 max_extent = entry->bytes; in setup_cluster_no_bitmap()
2435 if (entry->bytes < min_bytes) in setup_cluster_no_bitmap()
2439 window_free += entry->bytes; in setup_cluster_no_bitmap()
2440 if (entry->bytes > max_extent) in setup_cluster_no_bitmap()
2441 max_extent = entry->bytes; in setup_cluster_no_bitmap()
2444 if (window_free < bytes || max_extent < cont1_bytes) in setup_cluster_no_bitmap()
2460 if (entry->bitmap || entry->bytes < min_bytes) in setup_cluster_no_bitmap()
2466 total_size += entry->bytes; in setup_cluster_no_bitmap()
2482 struct list_head *bitmaps, u64 offset, u64 bytes, in setup_cluster_bitmap() argument
2505 if (entry->bytes < bytes) in setup_cluster_bitmap()
2508 bytes, cont1_bytes, min_bytes); in setup_cluster_bitmap()
2532 u64 offset, u64 bytes, u64 empty_size) in btrfs_find_space_cluster() argument
2548 cont1_bytes = min_bytes = bytes + empty_size; in btrfs_find_space_cluster()
2550 cont1_bytes = bytes; in btrfs_find_space_cluster()
2553 cont1_bytes = max(bytes, (bytes + empty_size) >> 2); in btrfs_find_space_cluster()
2563 if (ctl->free_space < bytes) { in btrfs_find_space_cluster()
2576 trace_btrfs_find_cluster(block_group, offset, bytes, empty_size, in btrfs_find_space_cluster()
2581 bytes + empty_size, in btrfs_find_space_cluster()
2585 offset, bytes + empty_size, in btrfs_find_space_cluster()
2621 u64 *total_trimmed, u64 start, u64 bytes, in do_trimming() argument
2641 start, bytes, &trimmed); in do_trimming()
2670 u64 bytes; in trim_no_bitmap() local
2703 extent_bytes = entry->bytes; in trim_no_bitmap()
2705 bytes = min(extent_start + extent_bytes, end) - start; in trim_no_bitmap()
2706 if (bytes < minlen) { in trim_no_bitmap()
2716 ret = do_trimming(block_group, total_trimmed, start, bytes, in trim_no_bitmap()
2721 start += bytes; in trim_no_bitmap()
2741 u64 bytes; in trim_bitmaps() local
2761 bytes = minlen; in trim_bitmaps()
2762 ret2 = search_bitmap(ctl, entry, &start, &bytes); in trim_bitmaps()
2769 bytes = min(bytes, end - start); in trim_bitmaps()
2770 if (bytes < minlen) { in trim_bitmaps()
2775 bitmap_clear_bits(ctl, entry, start, bytes); in trim_bitmaps()
2776 if (entry->bytes == 0) in trim_bitmaps()
2781 ret = do_trimming(block_group, total_trimmed, start, bytes, in trim_bitmaps()
2782 start, bytes); in trim_bitmaps()
2789 start += bytes; in trim_bitmaps()
2847 entry->bytes--; in btrfs_find_ino_for_alloc()
2848 if (!entry->bytes) in btrfs_find_ino_for_alloc()
2863 if (entry->bytes == 0) in btrfs_find_ino_for_alloc()
3011 u64 bytes) in check_exists() argument
3040 offset + bytes > bit_off) { in check_exists()
3050 if (tmp->offset + tmp->bytes < offset) in check_exists()
3052 if (offset + bytes < tmp->offset) { in check_exists()
3064 if (offset + bytes < tmp->offset) in check_exists()
3066 if (tmp->offset + tmp->bytes < offset) { in check_exists()
3082 if (offset > info->offset && offset < info->offset + info->bytes) in check_exists()
3096 u64 offset, u64 bytes, bool bitmap) in add_free_space_entry() argument
3114 info->bytes = bytes; in add_free_space_entry()
3140 bytes_added = add_bytes_to_bitmap(ctl, bitmap_info, offset, bytes); in add_free_space_entry()
3141 bytes -= bytes_added; in add_free_space_entry()
3145 if (bytes) in add_free_space_entry()