Lines Matching full:bytes

30 	u64 bytes;  member
510 static int io_ctl_add_entry(struct btrfs_io_ctl *io_ctl, u64 offset, u64 bytes, in io_ctl_add_entry() argument
520 entry->bytes = cpu_to_le64(bytes); in io_ctl_add_entry()
594 entry->bytes = le64_to_cpu(e->bytes); in io_ctl_read_entry()
644 if (prev->offset + prev->bytes == e->offset) { in merge_space_tree()
647 prev->bytes += e->bytes; in merge_space_tree()
750 if (!e->bytes) { in __load_free_space_cache()
947 ret = io_ctl_add_entry(io_ctl, e->offset, e->bytes, in write_cache_extent_entries()
977 trim_entry->bytes, NULL); in write_cache_extent_entries()
1423 static inline unsigned long bytes_to_bits(u64 bytes, u32 unit) in bytes_to_bits() argument
1425 return (unsigned long)(div_u64(bytes, unit)); in bytes_to_bits()
1498 * want a section that has at least bytes size and comes at or after the given
1556 prev->offset + prev->bytes > offset) in tree_search_offset()
1588 prev->offset + prev->bytes > offset) in tree_search_offset()
1593 } else if (entry->offset + entry->bytes > offset) in tree_search_offset()
1605 if (entry->offset + entry->bytes > offset) in tree_search_offset()
1629 ctl->free_space -= info->bytes; in unlink_free_space()
1637 ASSERT(info->bytes || info->bitmap); in link_free_space()
1643 ctl->free_space += info->bytes; in link_free_space()
1686 * bytes we can have, or whatever is less than that. in recalculate_thresholds()
1697 u64 offset, u64 bytes) in __bitmap_clear_bits() argument
1702 count = bytes_to_bits(bytes, ctl->unit); in __bitmap_clear_bits()
1707 info->bytes -= bytes; in __bitmap_clear_bits()
1714 u64 bytes) in bitmap_clear_bits() argument
1716 __bitmap_clear_bits(ctl, info, offset, bytes); in bitmap_clear_bits()
1717 ctl->free_space -= bytes; in bitmap_clear_bits()
1722 u64 bytes) in bitmap_set_bits() argument
1727 count = bytes_to_bits(bytes, ctl->unit); in bitmap_set_bits()
1732 info->bytes += bytes; in bitmap_set_bits()
1733 ctl->free_space += bytes; in bitmap_set_bits()
1737 * If we can not find suitable extent, we will use bytes to record
1742 u64 *bytes, bool for_alloc) in search_bitmap() argument
1756 bitmap_info->max_extent_size < *bytes) { in search_bitmap()
1757 *bytes = bitmap_info->max_extent_size; in search_bitmap()
1763 bits = bytes_to_bits(*bytes, ctl->unit); in search_bitmap()
1784 *bytes = (u64)(found_bits) * ctl->unit; in search_bitmap()
1788 *bytes = (u64)(max_bits) * ctl->unit; in search_bitmap()
1789 bitmap_info->max_extent_size = *bytes; in search_bitmap()
1797 return entry->bytes; in get_max_extent_size()
1800 /* Cache the size of the max extent in bytes */
1802 find_free_space(struct btrfs_free_space_ctl *ctl, u64 *offset, u64 *bytes, in find_free_space() argument
1820 if (entry->bytes < *bytes) { in find_free_space()
1829 if (*bytes >= align) { in find_free_space()
1839 if (entry->bytes < *bytes + align_off) { in find_free_space()
1846 u64 size = *bytes; in find_free_space()
1851 *bytes = size; in find_free_space()
1862 *bytes = entry->bytes - align_off; in find_free_space()
1873 info->bytes = 0; in add_new_bitmap()
1893 u64 *offset, u64 *bytes) in remove_from_bitmap() argument
1917 search_bytes = min(search_bytes, *bytes); in remove_from_bitmap()
1924 *bytes -= search_bytes; in remove_from_bitmap()
1926 if (*bytes) { in remove_from_bitmap()
1928 if (!bitmap_info->bytes) in remove_from_bitmap()
1932 * no entry after this bitmap, but we still have bytes to in remove_from_bitmap()
1962 } else if (!bitmap_info->bytes) in remove_from_bitmap()
1970 u64 bytes) in add_bytes_to_bitmap() argument
1977 bytes_to_set = min(end - offset, bytes); in add_bytes_to_bitmap()
1982 * We set some bytes, we have no idea what the max extent size is in add_bytes_to_bitmap()
2015 if (info->bytes <= fs_info->sectorsize * 4) { in use_bitmap()
2048 u64 bytes, offset, bytes_added; in insert_into_bitmap() local
2051 bytes = info->bytes; in insert_into_bitmap()
2088 offset, bytes); in insert_into_bitmap()
2089 bytes -= bytes_added; in insert_into_bitmap()
2093 if (!bytes) { in insert_into_bitmap()
2107 bytes_added = add_bytes_to_bitmap(ctl, bitmap_info, offset, bytes); in insert_into_bitmap()
2108 bytes -= bytes_added; in insert_into_bitmap()
2112 if (!bytes) { in insert_into_bitmap()
2167 u64 bytes = info->bytes; in try_merge_free_space() local
2174 right_info = tree_search_offset(ctl, offset + bytes, 0, 0); in try_merge_free_space()
2186 info->bytes += right_info->bytes; in try_merge_free_space()
2192 left_info->offset + left_info->bytes == offset) { in try_merge_free_space()
2198 info->bytes += left_info->bytes; in try_merge_free_space()
2213 const u64 end = info->offset + info->bytes; in steal_from_bitmap_to_end()
2215 u64 bytes; in steal_from_bitmap_to_end() local
2225 bytes = (j - i) * ctl->unit; in steal_from_bitmap_to_end()
2226 info->bytes += bytes; in steal_from_bitmap_to_end()
2229 bitmap_clear_bits(ctl, bitmap, end, bytes); in steal_from_bitmap_to_end()
2231 __bitmap_clear_bits(ctl, bitmap, end, bytes); in steal_from_bitmap_to_end()
2233 if (!bitmap->bytes) in steal_from_bitmap_to_end()
2248 u64 bytes; in steal_from_bitmap_to_front() local
2274 bytes = (i + 1) * ctl->unit; in steal_from_bitmap_to_front()
2276 bytes = (i - prev_j) * ctl->unit; in steal_from_bitmap_to_front()
2278 info->offset -= bytes; in steal_from_bitmap_to_front()
2279 info->bytes += bytes; in steal_from_bitmap_to_front()
2282 bitmap_clear_bits(ctl, bitmap, info->offset, bytes); in steal_from_bitmap_to_front()
2284 __bitmap_clear_bits(ctl, bitmap, info->offset, bytes); in steal_from_bitmap_to_front()
2286 if (!bitmap->bytes) in steal_from_bitmap_to_front()
2330 u64 offset, u64 bytes) in __btrfs_add_free_space() argument
2340 info->bytes = bytes; in __btrfs_add_free_space()
2392 u64 offset, u64 bytes) in btrfs_remove_free_space() argument
2403 if (!bytes) in btrfs_remove_free_space()
2429 u64 to_free = min(bytes, info->bytes); in btrfs_remove_free_space()
2431 info->bytes -= to_free; in btrfs_remove_free_space()
2433 if (info->bytes) { in btrfs_remove_free_space()
2441 bytes -= to_free; in btrfs_remove_free_space()
2444 u64 old_end = info->bytes + info->offset; in btrfs_remove_free_space()
2446 info->bytes = offset - info->offset; in btrfs_remove_free_space()
2452 /* Not enough bytes in this entry to satisfy us */ in btrfs_remove_free_space()
2453 if (old_end < offset + bytes) { in btrfs_remove_free_space()
2454 bytes -= old_end - offset; in btrfs_remove_free_space()
2457 } else if (old_end == offset + bytes) { in btrfs_remove_free_space()
2463 ret = btrfs_add_free_space(block_group, offset + bytes, in btrfs_remove_free_space()
2464 old_end - (offset + bytes)); in btrfs_remove_free_space()
2470 ret = remove_from_bitmap(ctl, info, &offset, &bytes); in btrfs_remove_free_space()
2482 u64 bytes) in btrfs_dump_free_space() argument
2493 if (info->bytes >= bytes && !block_group->ro) in btrfs_dump_free_space()
2495 btrfs_crit(fs_info, "entry offset %llu, bytes %llu, bitmap %s", in btrfs_dump_free_space()
2496 info->offset, info->bytes, in btrfs_dump_free_space()
2503 "%d blocks of free space at or bigger than bytes is", count); in btrfs_dump_free_space()
2624 u64 offset, u64 bytes, u64 empty_size, in btrfs_find_space_for_alloc() argument
2629 u64 bytes_search = bytes + empty_size; in btrfs_find_space_for_alloc()
2642 bitmap_clear_bits(ctl, entry, offset, bytes); in btrfs_find_space_for_alloc()
2643 if (!entry->bytes) in btrfs_find_space_for_alloc()
2650 entry->offset = offset + bytes; in btrfs_find_space_for_alloc()
2651 WARN_ON(entry->bytes < bytes + align_gap_len); in btrfs_find_space_for_alloc()
2653 entry->bytes -= bytes + align_gap_len; in btrfs_find_space_for_alloc()
2654 if (!entry->bytes) in btrfs_find_space_for_alloc()
2714 u64 bytes, u64 min_start, in btrfs_alloc_from_bitmap() argument
2720 u64 search_bytes = bytes; in btrfs_alloc_from_bitmap()
2724 search_bytes = bytes; in btrfs_alloc_from_bitmap()
2734 __bitmap_clear_bits(ctl, entry, ret, bytes); in btrfs_alloc_from_bitmap()
2740 * given a cluster, try to allocate 'bytes' from it, returns 0
2745 struct btrfs_free_cluster *cluster, u64 bytes, in btrfs_alloc_from_cluster() argument
2754 if (bytes > cluster->max_size) in btrfs_alloc_from_cluster()
2766 if (entry->bytes < bytes) in btrfs_alloc_from_cluster()
2770 if (entry->bytes < bytes || in btrfs_alloc_from_cluster()
2782 cluster, entry, bytes, in btrfs_alloc_from_cluster()
2793 cluster->window_start += bytes; in btrfs_alloc_from_cluster()
2797 entry->offset += bytes; in btrfs_alloc_from_cluster()
2798 entry->bytes -= bytes; in btrfs_alloc_from_cluster()
2801 if (entry->bytes == 0) in btrfs_alloc_from_cluster()
2813 ctl->free_space -= bytes; in btrfs_alloc_from_cluster()
2814 if (entry->bytes == 0) { in btrfs_alloc_from_cluster()
2833 u64 offset, u64 bytes, in btrfs_bitmap_cluster() argument
2849 want_bits = bytes_to_bits(bytes, ctl->unit); in btrfs_bitmap_cluster()
2908 * Try to find a cluster with at least bytes total bytes, at least one
2914 struct list_head *bitmaps, u64 offset, u64 bytes, in setup_cluster_no_bitmap() argument
2934 while (entry->bitmap || entry->bytes < min_bytes) { in setup_cluster_no_bitmap()
2943 window_free = entry->bytes; in setup_cluster_no_bitmap()
2944 max_extent = entry->bytes; in setup_cluster_no_bitmap()
2958 if (entry->bytes < min_bytes) in setup_cluster_no_bitmap()
2962 window_free += entry->bytes; in setup_cluster_no_bitmap()
2963 if (entry->bytes > max_extent) in setup_cluster_no_bitmap()
2964 max_extent = entry->bytes; in setup_cluster_no_bitmap()
2967 if (window_free < bytes || max_extent < cont1_bytes) in setup_cluster_no_bitmap()
2983 if (entry->bitmap || entry->bytes < min_bytes) in setup_cluster_no_bitmap()
2989 total_size += entry->bytes; in setup_cluster_no_bitmap()
3005 struct list_head *bitmaps, u64 offset, u64 bytes, in setup_cluster_bitmap() argument
3030 if (entry->bytes < bytes) in setup_cluster_bitmap()
3033 bytes, cont1_bytes, min_bytes); in setup_cluster_bitmap()
3047 * is to find at least bytes+empty_size.
3055 u64 offset, u64 bytes, u64 empty_size) in btrfs_find_space_cluster() argument
3072 cont1_bytes = min_bytes = bytes + empty_size; in btrfs_find_space_cluster()
3074 cont1_bytes = bytes; in btrfs_find_space_cluster()
3077 cont1_bytes = max(bytes, (bytes + empty_size) >> 2); in btrfs_find_space_cluster()
3087 if (ctl->free_space < bytes) { in btrfs_find_space_cluster()
3100 trace_btrfs_find_cluster(block_group, offset, bytes, empty_size, in btrfs_find_space_cluster()
3104 bytes + empty_size, in btrfs_find_space_cluster()
3108 offset, bytes + empty_size, in btrfs_find_space_cluster()
3145 u64 *total_trimmed, u64 start, u64 bytes, in do_trimming() argument
3166 ret = btrfs_discard_extent(fs_info, start, bytes, &trimmed); in do_trimming()
3198 u64 bytes; in trim_no_bitmap() local
3238 extent_bytes = entry->bytes; in trim_no_bitmap()
3240 bytes = min(extent_start + extent_bytes, end) - start; in trim_no_bitmap()
3241 if (bytes < minlen) { in trim_no_bitmap()
3252 trim_entry.bytes = extent_bytes; in trim_no_bitmap()
3256 ret = do_trimming(block_group, total_trimmed, start, bytes, in trim_no_bitmap()
3261 start += bytes; in trim_no_bitmap()
3281 u64 bytes; in trim_bitmaps() local
3305 bytes = minlen; in trim_bitmaps()
3306 ret2 = search_bitmap(ctl, entry, &start, &bytes, false); in trim_bitmaps()
3314 bytes = min(bytes, end - start); in trim_bitmaps()
3315 if (bytes < minlen) { in trim_bitmaps()
3321 bitmap_clear_bits(ctl, entry, start, bytes); in trim_bitmaps()
3322 if (entry->bytes == 0) in trim_bitmaps()
3327 trim_entry.bytes = bytes; in trim_bitmaps()
3331 ret = do_trimming(block_group, total_trimmed, start, bytes, in trim_bitmaps()
3332 start, bytes, &trim_entry); in trim_bitmaps()
3339 start += bytes; in trim_bitmaps()
3446 entry->bytes--; in btrfs_find_ino_for_alloc()
3447 if (!entry->bytes) in btrfs_find_ino_for_alloc()
3462 if (entry->bytes == 0) in btrfs_find_ino_for_alloc()
3594 u64 offset, u64 bytes, bool bitmap) in test_add_free_space_entry() argument
3612 info->bytes = bytes; in test_add_free_space_entry()
3640 bytes_added = add_bytes_to_bitmap(ctl, bitmap_info, offset, bytes); in test_add_free_space_entry()
3642 bytes -= bytes_added; in test_add_free_space_entry()
3646 if (bytes) in test_add_free_space_entry()
3662 u64 offset, u64 bytes) in test_check_exists() argument
3691 offset + bytes > bit_off) { in test_check_exists()
3701 if (tmp->offset + tmp->bytes < offset) in test_check_exists()
3703 if (offset + bytes < tmp->offset) { in test_check_exists()
3715 if (offset + bytes < tmp->offset) in test_check_exists()
3717 if (tmp->offset + tmp->bytes < offset) { in test_check_exists()
3734 if (offset > info->offset && offset < info->offset + info->bytes) in test_check_exists()