aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/extent_io.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-10-31 12:46:39 -0400
committerChris Mason <chris.mason@oracle.com>2008-10-31 12:46:39 -0400
commit70b99e6959a4c28ae1b314985eca731f3db72f1d (patch)
tree81578759fe422f7b17a734b8bf16b042aa02a046 /fs/btrfs/extent_io.c
parentd899e05215178fed903ad0e7fc1cb4d8e0cc0a88 (diff)
Btrfs: Compression corner fixes
Make sure we keep page->mapping NULL on the pages we're getting via alloc_page. It gets set so a few of the callbacks can do the right thing, but in general these pages don't have a mapping. Don't try to truncate compressed inline items in btrfs_drop_extents. The whole compressed item must be preserved. Don't try to create multipage inline compressed items. When we try to overwrite just the first page of the file, we would have to read in and recow all the pages after it in the same compressed inline items. For now, only create single page inline items. Make sure we lock pages in the correct order during delalloc. The search into the state tree for delalloc bytes can return bytes before the page we already have locked. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r--fs/btrfs/extent_io.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index eb3c12e7bea..9b37ce6e516 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1242,13 +1242,22 @@ again:
delalloc_end = 0;
found = find_delalloc_range(tree, &delalloc_start, &delalloc_end,
max_bytes);
- if (!found) {
+ if (!found || delalloc_end <= *start) {
*start = delalloc_start;
*end = delalloc_end;
return found;
}
/*
+ * start comes from the offset of locked_page. We have to lock
+ * pages in order, so we can't process delalloc bytes before
+ * locked_page
+ */
+ if (delalloc_start < *start) {
+ delalloc_start = *start;
+ }
+
+ /*
* make sure to limit the number of pages we try to lock down
* if we're looping.
*/