summaryrefslogtreecommitdiff
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-12-14 12:56:58 -0500
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:03:58 -0400
commite9906a98497c26a3c1a7532b51b81cc1fbdf9e1d (patch)
tree6c61b8d79f865ed7c06e26e6b8853f5a87b4efea /fs/btrfs/inode.c
parent6e3b96668eb34da6060a5189e6a73e9d62a3b178 (diff)
downloadlwn-e9906a98497c26a3c1a7532b51b81cc1fbdf9e1d.tar.gz
lwn-e9906a98497c26a3c1a7532b51b81cc1fbdf9e1d.zip
Fixes for loopback files in btrfs
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 41b0c7de7a59..e535c50e669b 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1893,8 +1893,19 @@ static void btrfs_truncate(struct inode *inode)
int btrfs_commit_write(struct file *file, struct page *page,
unsigned from, unsigned to)
{
- return extent_commit_write(&BTRFS_I(page->mapping->host)->extent_tree,
- page->mapping->host, page, from, to);
+ loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
+ struct inode *inode = page->mapping->host;
+
+ btrfs_cow_one_page(inode, page, PAGE_CACHE_SIZE);
+
+ set_page_extent_mapped(page);
+ set_page_dirty(page);
+
+ if (pos > inode->i_size) {
+ i_size_write(inode, pos);
+ mark_inode_dirty(inode);
+ }
+ return 0;
}
static int create_subvol(struct btrfs_root *root, char *name, int namelen)