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.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 62fcd79d8ab3..461b09663fed 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -231,7 +231,7 @@ static int dirty_and_release_pages(struct btrfs_trans_handle *trans,
231{ 231{
232 int err = 0; 232 int err = 0;
233 int i; 233 int i;
234 struct inode *inode = file->f_path.dentry->d_inode; 234 struct inode *inode = fdentry(file)->d_inode;
235 struct extent_map *em; 235 struct extent_map *em;
236 struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; 236 struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree;
237 u64 hint_byte; 237 u64 hint_byte;
@@ -652,7 +652,7 @@ static int prepare_pages(struct btrfs_root *root,
652{ 652{
653 int i; 653 int i;
654 unsigned long index = pos >> PAGE_CACHE_SHIFT; 654 unsigned long index = pos >> PAGE_CACHE_SHIFT;
655 struct inode *inode = file->f_path.dentry->d_inode; 655 struct inode *inode = fdentry(file)->d_inode;
656 int err = 0; 656 int err = 0;
657 u64 start_pos; 657 u64 start_pos;
658 658
@@ -666,7 +666,11 @@ static int prepare_pages(struct btrfs_root *root,
666 err = -ENOMEM; 666 err = -ENOMEM;
667 BUG_ON(1); 667 BUG_ON(1);
668 } 668 }
669#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
670 ClearPageDirty(pages[i]);
671#else
669 cancel_dirty_page(pages[i], PAGE_CACHE_SIZE); 672 cancel_dirty_page(pages[i], PAGE_CACHE_SIZE);
673#endif
670 wait_on_page_writeback(pages[i]); 674 wait_on_page_writeback(pages[i]);
671 set_page_extent_mapped(pages[i]); 675 set_page_extent_mapped(pages[i]);
672 WARN_ON(!PageLocked(pages[i])); 676 WARN_ON(!PageLocked(pages[i]));
@@ -682,7 +686,7 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
682 ssize_t num_written = 0; 686 ssize_t num_written = 0;
683 ssize_t err = 0; 687 ssize_t err = 0;
684 int ret = 0; 688 int ret = 0;
685 struct inode *inode = file->f_path.dentry->d_inode; 689 struct inode *inode = fdentry(file)->d_inode;
686 struct btrfs_root *root = BTRFS_I(inode)->root; 690 struct btrfs_root *root = BTRFS_I(inode)->root;
687 struct page **pages = NULL; 691 struct page **pages = NULL;
688 int nrptrs; 692 int nrptrs;
@@ -707,7 +711,7 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
707 goto out; 711 goto out;
708 if (count == 0) 712 if (count == 0)
709 goto out; 713 goto out;
710 err = remove_suid(file->f_path.dentry); 714 err = remove_suid(fdentry(file));
711 if (err) 715 if (err)
712 goto out; 716 goto out;
713 file_update_time(file); 717 file_update_time(file);
@@ -862,6 +866,9 @@ struct file_operations btrfs_file_operations = {
862 .read = do_sync_read, 866 .read = do_sync_read,
863 .aio_read = generic_file_aio_read, 867 .aio_read = generic_file_aio_read,
864 .splice_read = generic_file_splice_read, 868 .splice_read = generic_file_splice_read,
869#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
870 .sendfile = generic_file_sendfile,
871#endif
865 .write = btrfs_file_write, 872 .write = btrfs_file_write,
866 .mmap = btrfs_file_mmap, 873 .mmap = btrfs_file_mmap,
867 .open = generic_file_open, 874 .open = generic_file_open,