aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/extent_map.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-10-15 16:17:44 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:03:56 -0400
commite19caa5f0e34b571ed0c2617554af5c43cb124d1 (patch)
tree763e227bbce9325411955bb5cea5c5f1772b0a2d /fs/btrfs/extent_map.c
parent6b80053d02be41886344b5007d04e345311ec0b5 (diff)
Btrfs: Fix allocation routines to avoid intermixing data and metadata allocations
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_map.c')
-rw-r--r--fs/btrfs/extent_map.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index 7ef3397a266..e241699024d 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -981,7 +981,7 @@ int find_first_extent_bit(struct extent_map_tree *tree, u64 start,
struct extent_state *state;
int ret = 1;
- write_lock_irq(&tree->lock);
+ read_lock_irq(&tree->lock);
/*
* this search will find all the extents that end after
* our range starts.
@@ -993,7 +993,7 @@ int find_first_extent_bit(struct extent_map_tree *tree, u64 start,
while(1) {
state = rb_entry(node, struct extent_state, rb_node);
- if (state->state & bits) {
+ if (state->end >= start && (state->state & bits)) {
*start_ret = state->start;
*end_ret = state->end;
ret = 0;
@@ -1004,7 +1004,7 @@ int find_first_extent_bit(struct extent_map_tree *tree, u64 start,
break;
}
out:
- write_unlock_irq(&tree->lock);
+ read_unlock_irq(&tree->lock);
return ret;
}
EXPORT_SYMBOL(find_first_extent_bit);