Commit 9688e9a9 authored by Liu Bo's avatar Liu Bo Committed by David Sterba

Btrfs: use next_state in find_first_extent_bit

As next_state() is already defined to get the next state, use it in
find_first_extent_bit. No functional changes.
Signed-off-by: default avatarLiu Bo <bo.liu@linux.alibaba.com>
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent b72c3aba
......@@ -1424,20 +1424,15 @@ int find_first_extent_bit(struct extent_io_tree *tree, u64 start,
struct extent_state **cached_state)
{
struct extent_state *state;
struct rb_node *n;
int ret = 1;
spin_lock(&tree->lock);
if (cached_state && *cached_state) {
state = *cached_state;
if (state->end == start - 1 && extent_state_in_tree(state)) {
n = rb_next(&state->rb_node);
while (n) {
state = rb_entry(n, struct extent_state,
rb_node);
while ((state = next_state(state)) != NULL) {
if (state->state & bits)
goto got_it;
n = rb_next(n);
}
free_extent_state(*cached_state);
*cached_state = NULL;
......
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