Lines Matching refs:start
46 pr_err("BTRFS: state leak: start %llu end %llu state %u in tree %d refs %d\n",
47 state->start, state->end, state->state,
55 #define btrfs_debug_check_extent_io_range(tree, start, end) \
56 __btrfs_debug_check_extent_io_range(__func__, (tree), (start), (end))
59 u64 start, u64 end)
71 caller, btrfs_ino(inode), isize, start, end);
91 u64 start;
190 changeset->bytes_changed += state->end - state->start + 1;
191 ret = ulist_add(&changeset->range_changed, state->start, state->end,
218 * entry->start <= offset && entry->end >= offset.
247 if (offset < entry->start)
295 if (offset < entry->start)
309 while (entry && offset < entry->start)
347 if (other && other->end == state->start - 1 &&
351 state->start = other->start;
357 if (other && other->start == state->end + 1 &&
410 if (end < entry->start) {
417 entry->start, entry->end, state->start, end);
449 * the tree has 'orig' at [orig->start, orig->end]. After calling, there
451 * prealloc: [orig->start, split - 1]
466 prealloc->start = orig->start;
469 orig->start = split;
479 if (prealloc->end < entry->start) {
553 * The range [start, end] is inclusive.
557 int __clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
572 btrfs_debug_check_extent_io_range(tree, start, end);
573 trace_btrfs_clear_extent_bit(tree, start, end - start + 1, bits);
606 cached->start <= start && cached->end > start) {
617 state = tree_search(tree, start);
621 if (state->start > end)
623 WARN_ON(state->end < start);
647 if (state->start < start) {
651 err = split_state(tree, state, prealloc, start);
669 if (state->start <= end && state->end > end) {
690 start = last_end + 1;
691 if (start <= end && state && !need_resched())
695 if (start > end)
726 * The range [start, end] is inclusive.
729 void wait_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, u32 bits,
734 btrfs_debug_check_extent_io_range(tree, start, end);
745 state->start <= start && start < state->end)
753 state = tree_search(tree, start);
757 if (state->start > end)
761 start = state->start;
767 start = state->end + 1;
769 if (start > end)
807 * Find the first state struct with 'bits' set after 'start', and return it.
809 * 'start'.
812 u64 start, u32 bits)
820 state = tree_search(tree, start);
822 if (state->end >= start && (state->state & bits))
837 bool find_first_extent_bit(struct extent_io_tree *tree, u64 start,
847 if (state->end == start - 1 && extent_state_in_tree(state)) {
860 state = find_first_extent_bit_state(tree, start, bits);
864 *start_ret = state->start;
877 * @start: offset to start the search from
889 int find_contiguous_extent_bit(struct extent_io_tree *tree, u64 start,
896 state = find_first_extent_bit_state(tree, start, bits);
898 *start_ret = state->start;
901 if (state->start > (*end_ret + 1))
913 * than 'max_bytes'. start and end are used to return the range,
917 bool btrfs_find_delalloc_range(struct extent_io_tree *tree, u64 *start,
922 u64 cur_start = *start;
939 if (found && (state->start != cur_start ||
949 *start = state->start;
956 total_bytes += state->end - state->start + 1;
973 * existing range is returned in failed_state in this case, and the start of the
978 * [start, end] is inclusive This takes the tree lock.
980 static int __set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
997 btrfs_debug_check_extent_io_range(tree, start, end);
998 trace_btrfs_set_extent_bit(tree, start, end - start + 1, bits);
1019 if (state->start <= start && state->end > start &&
1027 state = tree_search_for_insert(tree, start, &p, &parent);
1032 prealloc->start = start;
1040 last_start = state->start;
1049 if (state->start == start && state->end <= end) {
1051 *failed_start = state->start;
1062 start = last_end + 1;
1064 if (start < end && state && state->start == start &&
1085 if (state->start < start) {
1087 *failed_start = start;
1098 start = state->end + 1;
1106 err = split_state(tree, state, prealloc, start);
1119 start = last_end + 1;
1121 if (start < end && state && state->start == start &&
1134 if (state->start > start) {
1149 prealloc->start = start;
1157 start = this_end + 1;
1166 if (state->start <= end && state->end > end) {
1168 *failed_start = start;
1189 if (start > end)
1205 int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
1208 return __set_extent_bit(tree, start, end, bits, NULL, NULL,
1216 * @start: the start offset in bytes
1230 int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
1243 btrfs_debug_check_extent_io_range(tree, start, end);
1244 trace_btrfs_convert_extent_bit(tree, start, end - start + 1, bits,
1264 if (state->start <= start && state->end > start &&
1273 state = tree_search_for_insert(tree, start, &p, &parent);
1280 prealloc->start = start;
1288 last_start = state->start;
1297 if (state->start == start && state->end <= end) {
1303 start = last_end + 1;
1304 if (start < end && state && state->start == start &&
1325 if (state->start < start) {
1331 err = split_state(tree, state, prealloc, start);
1343 start = last_end + 1;
1344 if (start < end && state && state->start == start &&
1357 if (state->start > start) {
1374 prealloc->start = start;
1381 start = this_end + 1;
1390 if (state->start <= end && state->end > end) {
1409 if (start > end)
1425 * Find the first range that has @bits not set. This range could start before
1426 * @start.
1429 * @start: offset at/after which the found extent should start
1439 void find_first_clear_extent_bit(struct extent_io_tree *tree, u64 start,
1449 state = tree_search_prev_next(tree, start, &prev, &next);
1460 * We are past the last allocated chunk, set start at
1471 * At this point 'state' either contains 'start' or start is
1474 if (in_range(start, state->start, state->end - state->start + 1)) {
1479 * start
1481 start = state->end + 1;
1484 * 'start' falls within a range that doesn't
1485 * have the bits set, so take its start as the
1490 * start
1492 *start_ret = state->start;
1499 * start
1505 * start
1516 * Find the longest stretch from start until an entry which has the
1520 if (state->end >= start && !(state->state & bits)) {
1523 *end_ret = state->start - 1;
1537 * @start: The start offset of the range. This value is updated to the
1550 * called only once or if each call does not start where the
1555 * then @start is updated with the offset of the first byte with the bits set.
1558 u64 *start, u64 search_end, u64 max_bytes,
1564 u64 cur_start = *start;
1582 if (cached->start <= cur_start && cur_start <= cached->end) {
1584 } else if (cached->start > cur_start) {
1588 * The cached state starts after our search range's start. Check
1592 * no previous state record, we can start from our cached state.
1597 else if (prev->start <= cur_start && cur_start <= prev->end)
1610 if (state->start > search_end)
1612 if (contig && found && state->start > last + 1)
1616 max(cur_start, state->start);
1620 *start = max(cur_start, state->start);
1647 int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end,
1654 if (cached && extent_state_in_tree(cached) && cached->start <= start &&
1655 cached->end > start)
1658 state = tree_search(tree, start);
1659 while (state && start <= end) {
1660 if (filled && state->start > start) {
1665 if (state->start > end)
1680 start = state->end + 1;
1681 if (start > end)
1694 int set_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
1705 return __set_extent_bit(tree, start, end, bits, NULL, NULL, NULL, changeset);
1708 int clear_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
1717 return __clear_extent_bit(tree, start, end, bits, NULL, changeset);
1720 int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end,
1726 err = __set_extent_bit(tree, start, end, EXTENT_LOCKED, &failed_start,
1729 if (failed_start > start)
1730 clear_extent_bit(tree, start, failed_start - 1,
1738 * Either insert or lock state struct between start and end use mask to tell
1741 int lock_extent(struct extent_io_tree *tree, u64 start, u64 end,
1748 err = __set_extent_bit(tree, start, end, EXTENT_LOCKED, &failed_start,
1751 if (failed_start != start)
1752 clear_extent_bit(tree, start, failed_start - 1,
1757 err = __set_extent_bit(tree, start, end, EXTENT_LOCKED,