Commit af60bed2 authored by Josef Bacik's avatar Josef Bacik

Btrfs: set range_start to the right start in count_range_bits

In count_range_bits we are adjusting total_bytes based on the range we are
searching for, but we don't adjust the range start according to the range we are
searching for, which makes for weird results.  For example, if the range

[0-8192]

is set DELALLOC, but I search for 4096-8192, I will get back 4096 for the number
of bytes found, but the range_start will be 0, which makes it look like the
range is [0-4096].  So instead set range_start = max(cur_start, state->start).
This makes everything come out right.  Thanks,
Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
parent fcb80c2a
......@@ -1480,7 +1480,7 @@ u64 count_range_bits(struct extent_io_tree *tree,
if (total_bytes >= max_bytes)
break;
if (!found) {
*start = state->start;
*start = max(cur_start, state->start);
found = 1;
}
last = state->end;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment