1
0
Fork 0

Btrfs: skip states when they does not contain bits to clear

Clearing a range's bits is different with setting them, since we don't
need to touch them when states do not contain bits we want.

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
hifive-unleashed-5.1
Liu Bo 2012-02-16 18:34:37 +08:00 committed by David Sterba
parent 285190d99f
commit 0449314a9c
1 changed files with 10 additions and 5 deletions

View File

@ -513,6 +513,15 @@ hit_next:
WARN_ON(state->end < start);
last_end = state->end;
if (state->end < end && !need_resched())
next_node = rb_next(&state->rb_node);
else
next_node = NULL;
/* the state doesn't have the wanted bits, go ahead */
if (!(state->state & bits))
goto next;
/*
* | ---- desired range ---- |
* | state | or
@ -565,12 +574,8 @@ hit_next:
goto out;
}
if (state->end < end && prealloc && !need_resched())
next_node = rb_next(&state->rb_node);
else
next_node = NULL;
set |= clear_state_bit(tree, state, &bits, wake);
next:
if (last_end == (u64)-1)
goto out;
start = last_end + 1;