diff options
| author | Liu Bo <liubo2009@cn.fujitsu.com> | 2012-02-16 05:34:37 -0500 |
|---|---|---|
| committer | David Sterba <dsterba@suse.cz> | 2012-02-16 11:23:17 -0500 |
| commit | 0449314a9cc5a7fb0bd42e2175a3c46f68f3a2b0 (patch) | |
| tree | 8c651bb7aad7c0529098c46b2dca9a7f02a282f9 | |
| parent | 285190d99fef696ec8b0041787387f013cb71d67 (diff) | |
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>
| -rw-r--r-- | fs/btrfs/extent_io.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 8d6f55fbd28e..fe14285b53f1 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
| @@ -513,6 +513,15 @@ hit_next: | |||
| 513 | WARN_ON(state->end < start); | 513 | WARN_ON(state->end < start); |
| 514 | last_end = state->end; | 514 | last_end = state->end; |
| 515 | 515 | ||
| 516 | if (state->end < end && !need_resched()) | ||
| 517 | next_node = rb_next(&state->rb_node); | ||
| 518 | else | ||
| 519 | next_node = NULL; | ||
| 520 | |||
| 521 | /* the state doesn't have the wanted bits, go ahead */ | ||
| 522 | if (!(state->state & bits)) | ||
| 523 | goto next; | ||
| 524 | |||
| 516 | /* | 525 | /* |
| 517 | * | ---- desired range ---- | | 526 | * | ---- desired range ---- | |
| 518 | * | state | or | 527 | * | state | or |
| @@ -565,12 +574,8 @@ hit_next: | |||
| 565 | goto out; | 574 | goto out; |
| 566 | } | 575 | } |
| 567 | 576 | ||
| 568 | if (state->end < end && prealloc && !need_resched()) | ||
| 569 | next_node = rb_next(&state->rb_node); | ||
| 570 | else | ||
| 571 | next_node = NULL; | ||
| 572 | |||
| 573 | set |= clear_state_bit(tree, state, &bits, wake); | 577 | set |= clear_state_bit(tree, state, &bits, wake); |
| 578 | next: | ||
| 574 | if (last_end == (u64)-1) | 579 | if (last_end == (u64)-1) |
| 575 | goto out; | 580 | goto out; |
| 576 | start = last_end + 1; | 581 | start = last_end + 1; |
