提交 af60bed2 编写于 作者: J 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: NJosef Bacik <josef@redhat.com>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册