summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLiu Bo <liubo2009@cn.fujitsu.com>2012-02-16 11:34:37 +0100
committerDavid Sterba <dsterba@suse.cz>2012-02-16 17:23:17 +0100
commit0449314a9cc5a7fb0bd42e2175a3c46f68f3a2b0 (patch)
tree8c651bb7aad7c0529098c46b2dca9a7f02a282f9 /fs
parentBtrfs: check return value of lookup_extent_mapping() correctly (diff)
downloadlinux-0449314a9cc5a7fb0bd42e2175a3c46f68f3a2b0.tar.xz
linux-0449314a9cc5a7fb0bd42e2175a3c46f68f3a2b0.zip
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/extent_io.c15
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:
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;