aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r--fs/btrfs/file.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 94c93373cb7d..0a5f4defe59b 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -34,6 +34,7 @@
34#include "disk-io.h" 34#include "disk-io.h"
35#include "transaction.h" 35#include "transaction.h"
36#include "btrfs_inode.h" 36#include "btrfs_inode.h"
37#include "ordered-data.h"
37#include "ioctl.h" 38#include "ioctl.h"
38#include "print-tree.h" 39#include "print-tree.h"
39 40
@@ -329,6 +330,7 @@ static int noinline dirty_and_release_pages(struct btrfs_trans_handle *trans,
329 root->fs_info->delalloc_bytes += (end_of_last_block + 1 - 330 root->fs_info->delalloc_bytes += (end_of_last_block + 1 -
330 start_pos) - existing_delalloc; 331 start_pos) - existing_delalloc;
331 spin_unlock(&root->fs_info->delalloc_lock); 332 spin_unlock(&root->fs_info->delalloc_lock);
333 btrfs_add_ordered_inode(inode);
332 } else { 334 } else {
333 u64 aligned_end; 335 u64 aligned_end;
334 /* step one, delete the existing extents in this range */ 336 /* step one, delete the existing extents in this range */
@@ -724,8 +726,6 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
724 726
725 pages = kmalloc(nrptrs * sizeof(struct page *), GFP_KERNEL); 727 pages = kmalloc(nrptrs * sizeof(struct page *), GFP_KERNEL);
726 728
727 down_read(&BTRFS_I(inode)->root->snap_sem);
728
729 mutex_lock(&inode->i_mutex); 729 mutex_lock(&inode->i_mutex);
730 first_index = pos >> PAGE_CACHE_SHIFT; 730 first_index = pos >> PAGE_CACHE_SHIFT;
731 last_index = (pos + count) >> PAGE_CACHE_SHIFT; 731 last_index = (pos + count) >> PAGE_CACHE_SHIFT;
@@ -804,7 +804,6 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
804 } 804 }
805out: 805out:
806 mutex_unlock(&inode->i_mutex); 806 mutex_unlock(&inode->i_mutex);
807 up_read(&BTRFS_I(inode)->root->snap_sem);
808 807
809out_nolock: 808out_nolock:
810 kfree(pages); 809 kfree(pages);