diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-10-31 12:46:39 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-10-31 12:46:39 -0400 |
commit | 70b99e6959a4c28ae1b314985eca731f3db72f1d (patch) | |
tree | 81578759fe422f7b17a734b8bf16b042aa02a046 /fs/btrfs/compression.c | |
parent | d899e05215178fed903ad0e7fc1cb4d8e0cc0a88 (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/compression.c')
-rw-r--r-- | fs/btrfs/compression.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 9adaa79adad..354913177ba 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -220,10 +220,12 @@ static void end_compressed_bio_write(struct bio *bio, int err) */ inode = cb->inode; tree = &BTRFS_I(inode)->io_tree; + cb->compressed_pages[0]->mapping = cb->inode->i_mapping; tree->ops->writepage_end_io_hook(cb->compressed_pages[0], cb->start, cb->start + cb->len - 1, NULL, 1); + cb->compressed_pages[0]->mapping = NULL; end_compressed_writeback(inode, cb->start, cb->len); /* note, our inode could be gone now */ @@ -306,6 +308,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start, else ret = 0; + page->mapping = NULL; if (ret || bio_add_page(bio, page, PAGE_CACHE_SIZE, 0) < PAGE_CACHE_SIZE) { bio_get(bio); @@ -423,6 +426,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, else ret = 0; + page->mapping = NULL; if (ret || bio_add_page(comp_bio, page, PAGE_CACHE_SIZE, 0) < PAGE_CACHE_SIZE) { bio_get(comp_bio); |