Lines Matching full:start
45 pr_err("BTRFS: state leak: start %llu end %llu state %u in tree %d refs %d\n", in btrfs_extent_state_leak_debug_check()
46 state->start, state->end, state->state, in btrfs_extent_state_leak_debug_check()
54 #define btrfs_debug_check_extent_io_range(tree, start, end) \ argument
55 __btrfs_debug_check_extent_io_range(__func__, (tree), (start), (end))
58 u64 start, u64 end) in __btrfs_debug_check_extent_io_range() argument
70 caller, btrfs_ino(BTRFS_I(inode)), isize, start, end); in __btrfs_debug_check_extent_io_range()
90 u64 start; member
190 changeset->bytes_changed += state->end - state->start + 1; in add_extent_changeset()
191 ret = ulist_add(&changeset->range_changed, state->start, state->end, in add_extent_changeset()
218 * entry->start <= offset && entry->end >= offset.
247 if (offset < entry->start) in tree_search_for_insert()
295 if (offset < entry->start) in tree_search_prev_next()
309 while (entry && offset < entry->start) in tree_search_prev_next()
347 if (other && other->end == state->start - 1 && in merge_state()
352 state->start = other->start; in merge_state()
358 if (other && other->start == state->end + 1 && in merge_state()
412 if (end < entry->start) { in insert_state()
419 entry->start, entry->end, state->start, end); in insert_state()
451 * the tree has 'orig' at [orig->start, orig->end]. After calling, there
453 * prealloc: [orig->start, split - 1]
468 prealloc->start = orig->start; in split_state()
471 orig->start = split; in split_state()
481 if (prealloc->end < entry->start) { in split_state()
545 * The range [start, end] is inclusive.
549 int __clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, in __clear_extent_bit() argument
562 btrfs_debug_check_extent_io_range(tree, start, end); in __clear_extent_bit()
563 trace_btrfs_clear_extent_bit(tree, start, end - start + 1, bits); in __clear_extent_bit()
596 cached->start <= start && cached->end > start) { in __clear_extent_bit()
607 state = tree_search(tree, start); in __clear_extent_bit()
611 if (state->start > end) in __clear_extent_bit()
613 WARN_ON(state->end < start); in __clear_extent_bit()
637 if (state->start < start) { in __clear_extent_bit()
640 err = split_state(tree, state, prealloc, start); in __clear_extent_bit()
658 if (state->start <= end && state->end > end) { in __clear_extent_bit()
678 start = last_end + 1; in __clear_extent_bit()
679 if (start <= end && state && !need_resched()) in __clear_extent_bit()
683 if (start > end) in __clear_extent_bit()
714 * The range [start, end] is inclusive.
717 void wait_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, u32 bits) in wait_extent_bit() argument
721 btrfs_debug_check_extent_io_range(tree, start, end); in wait_extent_bit()
730 state = tree_search(tree, start); in wait_extent_bit()
734 if (state->start > end) in wait_extent_bit()
738 start = state->start; in wait_extent_bit()
744 start = state->end + 1; in wait_extent_bit()
746 if (start > end) in wait_extent_bit()
778 * Find the first state struct with 'bits' set after 'start', and return it.
780 * 'start'.
783 u64 start, u32 bits) in find_first_extent_bit_state() argument
791 state = tree_search(tree, start); in find_first_extent_bit_state()
793 if (state->end >= start && (state->state & bits)) in find_first_extent_bit_state()
808 int find_first_extent_bit(struct extent_io_tree *tree, u64 start, in find_first_extent_bit() argument
818 if (state->end == start - 1 && extent_state_in_tree(state)) { in find_first_extent_bit()
831 state = find_first_extent_bit_state(tree, start, bits); in find_first_extent_bit()
835 *start_ret = state->start; in find_first_extent_bit()
848 * @start: offset to start the search from
860 int find_contiguous_extent_bit(struct extent_io_tree *tree, u64 start, in find_contiguous_extent_bit() argument
867 state = find_first_extent_bit_state(tree, start, bits); in find_contiguous_extent_bit()
869 *start_ret = state->start; in find_contiguous_extent_bit()
872 if (state->start > (*end_ret + 1)) in find_contiguous_extent_bit()
884 * than 'max_bytes'. start and end are used to return the range,
888 bool btrfs_find_delalloc_range(struct extent_io_tree *tree, u64 *start, in btrfs_find_delalloc_range() argument
893 u64 cur_start = *start; in btrfs_find_delalloc_range()
910 if (found && (state->start != cur_start || in btrfs_find_delalloc_range()
920 *start = state->start; in btrfs_find_delalloc_range()
927 total_bytes += state->end - state->start + 1; in btrfs_find_delalloc_range()
942 * part of the range already has the desired bits set. The start of the
945 * [start, end] is inclusive This takes the tree lock.
947 static int __set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, in __set_extent_bit() argument
961 btrfs_debug_check_extent_io_range(tree, start, end); in __set_extent_bit()
962 trace_btrfs_set_extent_bit(tree, start, end - start + 1, bits); in __set_extent_bit()
983 if (state->start <= start && state->end > start && in __set_extent_bit()
991 state = tree_search_for_insert(tree, start, &p, &parent); in __set_extent_bit()
995 prealloc->start = start; in __set_extent_bit()
1003 last_start = state->start; in __set_extent_bit()
1012 if (state->start == start && state->end <= end) { in __set_extent_bit()
1014 *failed_start = state->start; in __set_extent_bit()
1024 start = last_end + 1; in __set_extent_bit()
1026 if (start < end && state && state->start == start && in __set_extent_bit()
1047 if (state->start < start) { in __set_extent_bit()
1049 *failed_start = start; in __set_extent_bit()
1059 start = state->end + 1; in __set_extent_bit()
1066 err = split_state(tree, state, prealloc, start); in __set_extent_bit()
1079 start = last_end + 1; in __set_extent_bit()
1081 if (start < end && state && state->start == start && in __set_extent_bit()
1094 if (state->start > start) { in __set_extent_bit()
1108 prealloc->start = start; in __set_extent_bit()
1116 start = this_end + 1; in __set_extent_bit()
1125 if (state->start <= end && state->end > end) { in __set_extent_bit()
1127 *failed_start = start; in __set_extent_bit()
1146 if (start > end) in __set_extent_bit()
1162 int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, in set_extent_bit() argument
1165 return __set_extent_bit(tree, start, end, bits, NULL, cached_state, in set_extent_bit()
1173 * @start: the start offset in bytes
1187 int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, in convert_extent_bit() argument
1200 btrfs_debug_check_extent_io_range(tree, start, end); in convert_extent_bit()
1201 trace_btrfs_convert_extent_bit(tree, start, end - start + 1, bits, in convert_extent_bit()
1221 if (state->start <= start && state->end > start && in convert_extent_bit()
1230 state = tree_search_for_insert(tree, start, &p, &parent); in convert_extent_bit()
1237 prealloc->start = start; in convert_extent_bit()
1245 last_start = state->start; in convert_extent_bit()
1254 if (state->start == start && state->end <= end) { in convert_extent_bit()
1260 start = last_end + 1; in convert_extent_bit()
1261 if (start < end && state && state->start == start && in convert_extent_bit()
1282 if (state->start < start) { in convert_extent_bit()
1288 err = split_state(tree, state, prealloc, start); in convert_extent_bit()
1300 start = last_end + 1; in convert_extent_bit()
1301 if (start < end && state && state->start == start && in convert_extent_bit()
1314 if (state->start > start) { in convert_extent_bit()
1331 prealloc->start = start; in convert_extent_bit()
1338 start = this_end + 1; in convert_extent_bit()
1347 if (state->start <= end && state->end > end) { in convert_extent_bit()
1366 if (start > end) in convert_extent_bit()
1382 * Find the first range that has @bits not set. This range could start before
1383 * @start.
1386 * @start: offset at/after which the found extent should start
1396 void find_first_clear_extent_bit(struct extent_io_tree *tree, u64 start, in find_first_clear_extent_bit() argument
1406 state = tree_search_prev_next(tree, start, &prev, &next); in find_first_clear_extent_bit()
1417 * We are past the last allocated chunk, set start at in find_first_clear_extent_bit()
1428 * At this point 'state' either contains 'start' or start is in find_first_clear_extent_bit()
1431 if (in_range(start, state->start, state->end - state->start + 1)) { in find_first_clear_extent_bit()
1436 * start in find_first_clear_extent_bit()
1438 start = state->end + 1; in find_first_clear_extent_bit()
1441 * 'start' falls within a range that doesn't in find_first_clear_extent_bit()
1442 * have the bits set, so take its start as the in find_first_clear_extent_bit()
1447 * start in find_first_clear_extent_bit()
1449 *start_ret = state->start; in find_first_clear_extent_bit()
1456 * start in find_first_clear_extent_bit()
1462 * start in find_first_clear_extent_bit()
1473 * Find the longest stretch from start until an entry which has the in find_first_clear_extent_bit()
1477 if (state->end >= start && !(state->state & bits)) { in find_first_clear_extent_bit()
1480 *end_ret = state->start - 1; in find_first_clear_extent_bit()
1495 u64 *start, u64 search_end, u64 max_bytes, in count_range_bits() argument
1499 u64 cur_start = *start; in count_range_bits()
1515 if (state->start > search_end) in count_range_bits()
1517 if (contig && found && state->start > last + 1) in count_range_bits()
1521 max(cur_start, state->start); in count_range_bits()
1525 *start = max(cur_start, state->start); in count_range_bits()
1543 int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end, in test_range_bit() argument
1550 if (cached && extent_state_in_tree(cached) && cached->start <= start && in test_range_bit()
1551 cached->end > start) in test_range_bit()
1554 state = tree_search(tree, start); in test_range_bit()
1555 while (state && start <= end) { in test_range_bit()
1556 if (filled && state->start > start) { in test_range_bit()
1561 if (state->start > end) in test_range_bit()
1576 start = state->end + 1; in test_range_bit()
1577 if (start > end) in test_range_bit()
1590 int set_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, in set_record_extent_bits() argument
1601 return __set_extent_bit(tree, start, end, bits, NULL, NULL, changeset, in set_record_extent_bits()
1605 int clear_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, in clear_record_extent_bits() argument
1614 return __clear_extent_bit(tree, start, end, bits, NULL, GFP_NOFS, in clear_record_extent_bits()
1618 int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end) in try_lock_extent() argument
1623 err = __set_extent_bit(tree, start, end, EXTENT_LOCKED, &failed_start, in try_lock_extent()
1626 if (failed_start > start) in try_lock_extent()
1627 clear_extent_bit(tree, start, failed_start - 1, in try_lock_extent()
1635 * Either insert or lock state struct between start and end use mask to tell
1638 int lock_extent(struct extent_io_tree *tree, u64 start, u64 end, in lock_extent() argument
1644 err = __set_extent_bit(tree, start, end, EXTENT_LOCKED, &failed_start, in lock_extent()
1647 if (failed_start != start) in lock_extent()
1648 clear_extent_bit(tree, start, failed_start - 1, in lock_extent()
1652 err = __set_extent_bit(tree, start, end, EXTENT_LOCKED, in lock_extent()