Lines Matching full:start
73 static u64 range_end(u64 start, u64 len) in range_end() argument
75 if (start + len < start) in range_end()
77 return start + len; in range_end()
94 u64 end = range_end(em->start, em->len); in tree_insert()
100 if (em->start < entry->start) in tree_insert()
102 else if (em->start >= extent_map_end(entry)) in tree_insert()
109 while (parent && em->start >= extent_map_end(entry)) { in tree_insert()
114 if (end > entry->start && em->start < extent_map_end(entry)) in tree_insert()
119 while (parent && em->start < entry->start) { in tree_insert()
124 if (end > entry->start && em->start < extent_map_end(entry)) in tree_insert()
152 if (offset < entry->start) in __tree_search()
177 while (prev && offset < prev_entry->start) { in __tree_search()
230 if (extent_map_end(prev) != next->start) in mergeable_maps()
310 "%s, start=%llu len=%llu disk_bytenr=%llu disk_num_bytes=%llu ram_bytes=%llu offset=%llu flags=0x%x… in dump_extent_map()
311 prefix, em->start, em->len, em->disk_bytenr, em->disk_num_bytes, in dump_extent_map()
360 if (em->start != 0) { in try_merge_map()
365 em->start = merge->start; in try_merge_map()
402 * @start: logical offset in the file
412 * -EUCLEAN if the found extent does not match the expected start
414 int unpin_extent_cache(struct btrfs_inode *inode, u64 start, u64 len, u64 gen) in unpin_extent_cache() argument
422 em = lookup_extent_mapping(tree, start, len); in unpin_extent_cache()
428 start, start + len, gen); in unpin_extent_cache()
433 if (WARN_ON(em->start != start)) { in unpin_extent_cache()
435 "found extent map for inode %llu (root %lld) with unexpected start offset %llu when unpinning exten… in unpin_extent_cache()
437 em->start, start, start + len, gen); in unpin_extent_cache()
515 u64 start, u64 len, int strict) in __lookup_extent_mapping() argument
520 u64 end = range_end(start, len); in __lookup_extent_mapping()
522 rb_node = __tree_search(&tree->root, start, &prev_or_next); in __lookup_extent_mapping()
532 if (strict && !(end > em->start && start < extent_map_end(em))) in __lookup_extent_mapping()
540 * Lookup extent_map that intersects @start + @len range.
543 * @start: byte offset to start the search
547 * [start, len] range. There may be additional objects in the tree that
552 u64 start, u64 len) in lookup_extent_mapping() argument
554 return __lookup_extent_mapping(tree, start, len, 1); in lookup_extent_mapping()
558 * Find a nearby extent map intersecting @start + @len (not an exact search).
561 * @start: byte offset to start the search
565 * [start, len] range.
570 u64 start, u64 len) in search_extent_mapping() argument
572 return __lookup_extent_mapping(tree, start, len, 0); in search_extent_mapping()
654 u64 start; in merge_extent_mapping() local
658 if (map_start < em->start || map_start >= extent_map_end(em)) in merge_extent_mapping()
661 if (existing->start > map_start) { in merge_extent_mapping()
669 start = prev ? extent_map_end(prev) : em->start; in merge_extent_mapping()
670 start = max_t(u64, start, em->start); in merge_extent_mapping()
671 end = next ? next->start : extent_map_end(em); in merge_extent_mapping()
673 start_diff = start - em->start; in merge_extent_mapping()
674 em->start = start; in merge_extent_mapping()
675 em->len = end - start; in merge_extent_mapping()
686 * @start: start of the logical range btrfs_get_extent() is requesting
689 * Note that @em_in's range may be different from [start, start+len),
694 * a) Returning the existing extent in @em_in if @start is within the
702 struct extent_map **em_in, u64 start, u64 len) in btrfs_add_extent_mapping() argument
713 ASSERT(em->start == 0); in btrfs_add_extent_mapping()
723 existing = search_extent_mapping(&inode->extent_tree, start, len); in btrfs_add_extent_mapping()
725 trace_btrfs_handle_em_exist(fs_info, existing, em, start, len); in btrfs_add_extent_mapping()
731 if (start >= existing->start && in btrfs_add_extent_mapping()
732 start < extent_map_end(existing)) { in btrfs_add_extent_mapping()
737 u64 orig_start = em->start; in btrfs_add_extent_mapping()
742 * the [start, start + len) range which overlaps in btrfs_add_extent_mapping()
744 ret = merge_extent_mapping(inode, existing, em, start); in btrfs_add_extent_mapping()
749 "extent map merge error existing [%llu, %llu) with em [%llu, %llu) start %llu", in btrfs_add_extent_mapping()
750 existing->start, extent_map_end(existing), in btrfs_add_extent_mapping()
751 orig_start, orig_start + orig_len, start); in btrfs_add_extent_mapping()
794 * @start: Start offset of the range.
798 * This drops all the extent maps that intersect the given range [@start, @end].
804 void btrfs_drop_extent_map_range(struct btrfs_inode *inode, u64 start, u64 end, in btrfs_drop_extent_map_range() argument
811 u64 len = end - start + 1; in btrfs_drop_extent_map_range()
813 WARN_ON(end < start); in btrfs_drop_extent_map_range()
815 if (start == 0 && !skip_pinned) { in btrfs_drop_extent_map_range()
837 em = lookup_extent_mapping(em_tree, start, len); in btrfs_drop_extent_map_range()
850 if (next_em->start < end) in btrfs_drop_extent_map_range()
858 start = em_end; in btrfs_drop_extent_map_range()
875 if (em->start >= start && em_end <= end) in btrfs_drop_extent_map_range()
880 if (em->start < start) { in btrfs_drop_extent_map_range()
887 split->start = em->start; in btrfs_drop_extent_map_range()
888 split->len = start - em->start; in btrfs_drop_extent_map_range()
916 split->start = end; in btrfs_drop_extent_map_range()
924 split->offset = em->offset + end - em->start; in btrfs_drop_extent_map_range()
968 if ((em->start < start || em_end > end) && modified) { in btrfs_drop_extent_map_range()
1010 const u64 end = new_em->start + new_em->len - 1; in btrfs_replace_extent_map_range()
1025 btrfs_drop_extent_map_range(inode, new_em->start, end, false); in btrfs_replace_extent_map_range()
1035 * Split off the first pre bytes from the extent_map at [start, start + len],
1040 int split_extent_map(struct btrfs_inode *inode, u64 start, u64 len, u64 pre, in split_extent_map() argument
1062 lock_extent(&inode->io_tree, start, start + len - 1, NULL); in split_extent_map()
1064 em = lookup_extent_mapping(em_tree, start, len); in split_extent_map()
1080 /* First, replace the em with a new extent_map starting from * em->start */ in split_extent_map()
1081 split_pre->start = em->start; in split_extent_map()
1094 * [em->start, em->start + pre] in split_extent_map()
1098 split_mid->start = em->start + pre; in split_extent_map()
1115 unlock_extent(&inode->io_tree, start, start + len - 1, NULL); in split_extent_map()
1248 * that when processing the next root we start from its first inode. in btrfs_scan_root()
1270 * one start from the next inode in case it starts before we finish. in btrfs_free_extent_maps()