aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/inode.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 3cc5677f5440..3a6f953337b5 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4909,10 +4909,21 @@ again:
4909 goto again; 4909 goto again;
4910 } 4910 }
4911 4911
4912 /*
4913 * XXX - page_mkwrite gets called every time the page is dirtied, even
4914 * if it was already dirty, so for space accounting reasons we need to
4915 * clear any delalloc bits for the range we are fixing to save. There
4916 * is probably a better way to do this, but for now keep consistent with
4917 * prepare_pages in the normal write path.
4918 */
4919 clear_extent_bits(&BTRFS_I(inode)->io_tree, page_start, page_end,
4920 EXTENT_DIRTY | EXTENT_DELALLOC, GFP_NOFS);
4921
4912 ret = btrfs_set_extent_delalloc(inode, page_start, page_end); 4922 ret = btrfs_set_extent_delalloc(inode, page_start, page_end);
4913 if (ret) { 4923 if (ret) {
4914 unlock_extent(io_tree, page_start, page_end, GFP_NOFS); 4924 unlock_extent(io_tree, page_start, page_end, GFP_NOFS);
4915 ret = VM_FAULT_SIGBUS; 4925 ret = VM_FAULT_SIGBUS;
4926 btrfs_free_reserved_data_space(root, inode, PAGE_CACHE_SIZE);
4916 goto out_unlock; 4927 goto out_unlock;
4917 } 4928 }
4918 ret = 0; 4929 ret = 0;