summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_map.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-12-18 16:25:45 -0500
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:03:58 -0400
commit190662b2128dd648749e197f5563e9f6bbb5e05c (patch)
treedba934f3932650ad4f975073d1871c7424ef18d2 /fs/btrfs/extent_map.c
parent4aec2b52327b3a3a20faa3f1af3102c0d97c7c92 (diff)
downloadlinux-190662b2128dd648749e197f5563e9f6bbb5e05c.tar.gz
linux-190662b2128dd648749e197f5563e9f6bbb5e05c.tar.bz2
linux-190662b2128dd648749e197f5563e9f6bbb5e05c.zip
Btrfs: Fix delayed allocation to avoid missing delalloc extents
find_lock_delalloc_range could exit out too early Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_map.c')
-rw-r--r--fs/btrfs/extent_map.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index 0d1e59a86e49..a0dff34dd437 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -1070,6 +1070,7 @@ u64 find_lock_delalloc_range(struct extent_map_tree *tree,
search_again:
node = tree_search(&tree->state, cur_start);
if (!node || IS_ERR(node)) {
+ *end = (u64)-1;
goto out;
}
@@ -1079,6 +1080,8 @@ search_again:
goto out;
}
if (!(state->state & EXTENT_DELALLOC)) {
+ if (!found)
+ *end = state->end;
goto out;
}
if (!found) {
@@ -1841,8 +1844,10 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
nr_delalloc = find_lock_delalloc_range(tree, &delalloc_start,
&delalloc_end,
128 * 1024 * 1024);
- if (nr_delalloc <= 0)
- break;
+ if (nr_delalloc == 0) {
+ delalloc_start = delalloc_end + 1;
+ continue;
+ }
tree->ops->fill_delalloc(inode, delalloc_start,
delalloc_end);
clear_extent_bit(tree, delalloc_start,