Lines Matching refs:bytes

26 	u64 bytes;  member
500 static int io_ctl_add_entry(struct btrfs_io_ctl *io_ctl, u64 offset, u64 bytes, in io_ctl_add_entry() argument
510 entry->bytes = cpu_to_le64(bytes); in io_ctl_add_entry()
584 entry->bytes = le64_to_cpu(e->bytes); in io_ctl_read_entry()
634 if (prev->offset + prev->bytes == e->offset) { in merge_space_tree()
637 prev->bytes += e->bytes; in merge_space_tree()
740 if (!e->bytes) { in __load_free_space_cache()
917 ret = io_ctl_add_entry(io_ctl, e->offset, e->bytes, in write_cache_extent_entries()
947 trim_entry->bytes, NULL); in write_cache_extent_entries()
1397 static inline unsigned long bytes_to_bits(u64 bytes, u32 unit) in bytes_to_bits() argument
1399 return (unsigned long)(div_u64(bytes, unit)); in bytes_to_bits()
1530 prev->offset + prev->bytes > offset) in tree_search_offset()
1562 prev->offset + prev->bytes > offset) in tree_search_offset()
1567 } else if (entry->offset + entry->bytes > offset) in tree_search_offset()
1579 if (entry->offset + entry->bytes > offset) in tree_search_offset()
1603 ctl->free_space -= info->bytes; in unlink_free_space()
1611 ASSERT(info->bytes || info->bitmap); in link_free_space()
1617 ctl->free_space += info->bytes; in link_free_space()
1671 u64 offset, u64 bytes) in __bitmap_clear_bits() argument
1676 count = bytes_to_bits(bytes, ctl->unit); in __bitmap_clear_bits()
1681 info->bytes -= bytes; in __bitmap_clear_bits()
1686 u64 bytes) in bitmap_clear_bits() argument
1688 __bitmap_clear_bits(ctl, info, offset, bytes); in bitmap_clear_bits()
1689 ctl->free_space -= bytes; in bitmap_clear_bits()
1694 u64 bytes) in bitmap_set_bits() argument
1699 count = bytes_to_bits(bytes, ctl->unit); in bitmap_set_bits()
1704 info->bytes += bytes; in bitmap_set_bits()
1705 ctl->free_space += bytes; in bitmap_set_bits()
1714 u64 *bytes, bool for_alloc) in search_bitmap() argument
1728 bitmap_info->max_extent_size < *bytes) { in search_bitmap()
1729 *bytes = bitmap_info->max_extent_size; in search_bitmap()
1735 bits = bytes_to_bits(*bytes, ctl->unit); in search_bitmap()
1756 *bytes = (u64)(found_bits) * ctl->unit; in search_bitmap()
1760 *bytes = (u64)(max_bits) * ctl->unit; in search_bitmap()
1761 bitmap_info->max_extent_size = *bytes; in search_bitmap()
1767 find_free_space(struct btrfs_free_space_ctl *ctl, u64 *offset, u64 *bytes, in find_free_space() argument
1785 if (entry->bytes < *bytes) { in find_free_space()
1786 if (entry->bytes > *max_extent_size) in find_free_space()
1787 *max_extent_size = entry->bytes; in find_free_space()
1794 if (*bytes >= align) { in find_free_space()
1804 if (entry->bytes < *bytes + align_off) { 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()
1811 u64 size = *bytes; in find_free_space()
1816 *bytes = size; in find_free_space()
1825 *bytes = entry->bytes - align_off; in find_free_space()
1836 info->bytes = 0; in add_new_bitmap()
1856 u64 *offset, u64 *bytes) in remove_from_bitmap() argument
1880 search_bytes = min(search_bytes, *bytes); in remove_from_bitmap()
1887 *bytes -= search_bytes; in remove_from_bitmap()
1889 if (*bytes) { in remove_from_bitmap()
1891 if (!bitmap_info->bytes) in remove_from_bitmap()
1925 } else if (!bitmap_info->bytes) in remove_from_bitmap()
1933 u64 bytes) in add_bytes_to_bitmap() argument
1940 bytes_to_set = min(end - offset, bytes); in add_bytes_to_bitmap()
1978 if (info->bytes <= fs_info->sectorsize * 4) { in use_bitmap()
2011 u64 bytes, offset, bytes_added; in insert_into_bitmap() local
2014 bytes = info->bytes; in insert_into_bitmap()
2051 offset, bytes); in insert_into_bitmap()
2052 bytes -= bytes_added; in insert_into_bitmap()
2056 if (!bytes) { in insert_into_bitmap()
2070 bytes_added = add_bytes_to_bitmap(ctl, bitmap_info, offset, bytes); in insert_into_bitmap()
2071 bytes -= bytes_added; in insert_into_bitmap()
2075 if (!bytes) { in insert_into_bitmap()
2128 u64 bytes = info->bytes; in try_merge_free_space() local
2135 right_info = tree_search_offset(ctl, offset + bytes, 0, 0); in try_merge_free_space()
2147 info->bytes += right_info->bytes; in try_merge_free_space()
2153 left_info->offset + left_info->bytes == offset) { in try_merge_free_space()
2159 info->bytes += left_info->bytes; in try_merge_free_space()
2174 const u64 end = info->offset + info->bytes; in steal_from_bitmap_to_end()
2176 u64 bytes; in steal_from_bitmap_to_end() local
2186 bytes = (j - i) * ctl->unit; in steal_from_bitmap_to_end()
2187 info->bytes += bytes; in steal_from_bitmap_to_end()
2190 bitmap_clear_bits(ctl, bitmap, end, bytes); in steal_from_bitmap_to_end()
2192 __bitmap_clear_bits(ctl, bitmap, end, bytes); in steal_from_bitmap_to_end()
2194 if (!bitmap->bytes) in steal_from_bitmap_to_end()
2209 u64 bytes; in steal_from_bitmap_to_front() local
2235 bytes = (i + 1) * ctl->unit; in steal_from_bitmap_to_front()
2237 bytes = (i - prev_j) * ctl->unit; in steal_from_bitmap_to_front()
2239 info->offset -= bytes; in steal_from_bitmap_to_front()
2240 info->bytes += bytes; in steal_from_bitmap_to_front()
2243 bitmap_clear_bits(ctl, bitmap, info->offset, bytes); in steal_from_bitmap_to_front()
2245 __bitmap_clear_bits(ctl, bitmap, info->offset, bytes); in steal_from_bitmap_to_front()
2247 if (!bitmap->bytes) in steal_from_bitmap_to_front()
2291 u64 offset, u64 bytes) in __btrfs_add_free_space() argument
2301 info->bytes = bytes; in __btrfs_add_free_space()
2345 u64 offset, u64 bytes) in btrfs_remove_free_space() argument
2356 if (!bytes) in btrfs_remove_free_space()
2382 u64 to_free = min(bytes, info->bytes); in btrfs_remove_free_space()
2384 info->bytes -= to_free; in btrfs_remove_free_space()
2386 if (info->bytes) { in btrfs_remove_free_space()
2394 bytes -= to_free; in btrfs_remove_free_space()
2397 u64 old_end = info->bytes + info->offset; in btrfs_remove_free_space()
2399 info->bytes = offset - info->offset; in btrfs_remove_free_space()
2406 if (old_end < offset + bytes) { in btrfs_remove_free_space()
2407 bytes -= old_end - offset; in btrfs_remove_free_space()
2410 } else if (old_end == offset + bytes) { in btrfs_remove_free_space()
2416 ret = btrfs_add_free_space(block_group, offset + bytes, in btrfs_remove_free_space()
2417 old_end - (offset + bytes)); in btrfs_remove_free_space()
2423 ret = remove_from_bitmap(ctl, info, &offset, &bytes); in btrfs_remove_free_space()
2435 u64 bytes) in btrfs_dump_free_space() argument
2445 if (info->bytes >= bytes && !block_group->ro) in btrfs_dump_free_space()
2448 info->offset, info->bytes, in btrfs_dump_free_space()
2575 u64 offset, u64 bytes, u64 empty_size, in btrfs_find_space_for_alloc() argument
2580 u64 bytes_search = bytes + empty_size; in btrfs_find_space_for_alloc()
2593 bitmap_clear_bits(ctl, entry, offset, bytes); in btrfs_find_space_for_alloc()
2594 if (!entry->bytes) in btrfs_find_space_for_alloc()
2601 entry->offset = offset + bytes; in btrfs_find_space_for_alloc()
2602 WARN_ON(entry->bytes < bytes + align_gap_len); in btrfs_find_space_for_alloc()
2604 entry->bytes -= bytes + align_gap_len; in btrfs_find_space_for_alloc()
2605 if (!entry->bytes) in btrfs_find_space_for_alloc()
2665 u64 bytes, u64 min_start, in btrfs_alloc_from_bitmap() argument
2671 u64 search_bytes = bytes; in btrfs_alloc_from_bitmap()
2675 search_bytes = bytes; in btrfs_alloc_from_bitmap()
2685 __bitmap_clear_bits(ctl, entry, ret, bytes); in btrfs_alloc_from_bitmap()
2696 struct btrfs_free_cluster *cluster, u64 bytes, in btrfs_alloc_from_cluster() argument
2705 if (bytes > cluster->max_size) in btrfs_alloc_from_cluster()
2717 if (entry->bytes < bytes && entry->bytes > *max_extent_size) in btrfs_alloc_from_cluster()
2718 *max_extent_size = entry->bytes; in btrfs_alloc_from_cluster()
2720 if (entry->bytes < bytes || in btrfs_alloc_from_cluster()
2732 cluster, entry, bytes, in btrfs_alloc_from_cluster()
2743 cluster->window_start += bytes; in btrfs_alloc_from_cluster()
2747 entry->offset += bytes; in btrfs_alloc_from_cluster()
2748 entry->bytes -= bytes; in btrfs_alloc_from_cluster()
2751 if (entry->bytes == 0) in btrfs_alloc_from_cluster()
2763 ctl->free_space -= bytes; in btrfs_alloc_from_cluster()
2764 if (entry->bytes == 0) { in btrfs_alloc_from_cluster()
2782 u64 offset, u64 bytes, in btrfs_bitmap_cluster() argument
2798 want_bits = bytes_to_bits(bytes, ctl->unit); in btrfs_bitmap_cluster()
2863 struct list_head *bitmaps, u64 offset, u64 bytes, in setup_cluster_no_bitmap() argument
2883 while (entry->bitmap || entry->bytes < min_bytes) { in setup_cluster_no_bitmap()
2892 window_free = entry->bytes; in setup_cluster_no_bitmap()
2893 max_extent = entry->bytes; in setup_cluster_no_bitmap()
2907 if (entry->bytes < min_bytes) in setup_cluster_no_bitmap()
2911 window_free += entry->bytes; in setup_cluster_no_bitmap()
2912 if (entry->bytes > max_extent) in setup_cluster_no_bitmap()
2913 max_extent = entry->bytes; in setup_cluster_no_bitmap()
2916 if (window_free < bytes || max_extent < cont1_bytes) in setup_cluster_no_bitmap()
2932 if (entry->bitmap || entry->bytes < min_bytes) in setup_cluster_no_bitmap()
2938 total_size += entry->bytes; in setup_cluster_no_bitmap()
2954 struct list_head *bitmaps, u64 offset, u64 bytes, in setup_cluster_bitmap() argument
2979 if (entry->bytes < bytes) in setup_cluster_bitmap()
2982 bytes, cont1_bytes, min_bytes); in setup_cluster_bitmap()
3005 u64 offset, u64 bytes, u64 empty_size) in btrfs_find_space_cluster() argument
3021 cont1_bytes = min_bytes = bytes + empty_size; in btrfs_find_space_cluster()
3023 cont1_bytes = bytes; in btrfs_find_space_cluster()
3026 cont1_bytes = max(bytes, (bytes + empty_size) >> 2); in btrfs_find_space_cluster()
3036 if (ctl->free_space < bytes) { in btrfs_find_space_cluster()
3049 trace_btrfs_find_cluster(block_group, offset, bytes, empty_size, in btrfs_find_space_cluster()
3053 bytes + empty_size, in btrfs_find_space_cluster()
3057 offset, bytes + empty_size, in btrfs_find_space_cluster()
3094 u64 *total_trimmed, u64 start, u64 bytes, in do_trimming() argument
3115 ret = btrfs_discard_extent(fs_info, start, bytes, &trimmed); in do_trimming()
3147 u64 bytes; in trim_no_bitmap() local
3187 extent_bytes = entry->bytes; in trim_no_bitmap()
3189 bytes = min(extent_start + extent_bytes, end) - start; in trim_no_bitmap()
3190 if (bytes < minlen) { in trim_no_bitmap()
3201 trim_entry.bytes = extent_bytes; in trim_no_bitmap()
3205 ret = do_trimming(block_group, total_trimmed, start, bytes, in trim_no_bitmap()
3210 start += bytes; in trim_no_bitmap()
3230 u64 bytes; in trim_bitmaps() local
3254 bytes = minlen; in trim_bitmaps()
3255 ret2 = search_bitmap(ctl, entry, &start, &bytes, false); in trim_bitmaps()
3263 bytes = min(bytes, end - start); in trim_bitmaps()
3264 if (bytes < minlen) { in trim_bitmaps()
3270 bitmap_clear_bits(ctl, entry, start, bytes); in trim_bitmaps()
3271 if (entry->bytes == 0) in trim_bitmaps()
3276 trim_entry.bytes = bytes; in trim_bitmaps()
3280 ret = do_trimming(block_group, total_trimmed, start, bytes, in trim_bitmaps()
3281 start, bytes, &trim_entry); in trim_bitmaps()
3288 start += bytes; in trim_bitmaps()
3399 entry->bytes--; in btrfs_find_ino_for_alloc()
3400 if (!entry->bytes) in btrfs_find_ino_for_alloc()
3415 if (entry->bytes == 0) in btrfs_find_ino_for_alloc()
3547 u64 offset, u64 bytes, bool bitmap) in test_add_free_space_entry() argument
3565 info->bytes = bytes; in test_add_free_space_entry()
3593 bytes_added = add_bytes_to_bitmap(ctl, bitmap_info, offset, bytes); in test_add_free_space_entry()
3595 bytes -= bytes_added; in test_add_free_space_entry()
3599 if (bytes) in test_add_free_space_entry()
3615 u64 offset, u64 bytes) in test_check_exists() argument
3644 offset + bytes > bit_off) { in test_check_exists()
3654 if (tmp->offset + tmp->bytes < offset) in test_check_exists()
3656 if (offset + bytes < tmp->offset) { in test_check_exists()
3668 if (offset + bytes < tmp->offset) in test_check_exists()
3670 if (tmp->offset + tmp->bytes < offset) { in test_check_exists()
3687 if (offset > info->offset && offset < info->offset + info->bytes) in test_check_exists()