aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2010-05-20 03:21:50 -0400
committerChris Mason <chris.mason@oracle.com>2010-06-11 11:46:12 -0400
commit058a457ef0ce28d595af53d6103db73332383cbc (patch)
tree7f17117d57c90839cd6d50e588cba0bca97a0de6 /fs
parent0e4dcbef1c0c3e29f9c7f824359445d385b2649a (diff)
Btrfs: fix remap_file_pages error
when we use remap_file_pages() to remap a file, remap_file_pages always return error. It is because btrfs didn't set VM_CAN_NONLINEAR for vma. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/file.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index abcb91867b56..ce0cd29efa9e 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1189,8 +1189,15 @@ static const struct vm_operations_struct btrfs_file_vm_ops = {
1189 1189
1190static int btrfs_file_mmap(struct file *filp, struct vm_area_struct *vma) 1190static int btrfs_file_mmap(struct file *filp, struct vm_area_struct *vma)
1191{ 1191{
1192 vma->vm_ops = &btrfs_file_vm_ops; 1192 struct address_space *mapping = filp->f_mapping;
1193
1194 if (!mapping->a_ops->readpage)
1195 return -ENOEXEC;
1196
1193 file_accessed(filp); 1197 file_accessed(filp);
1198 vma->vm_ops = &btrfs_file_vm_ops;
1199 vma->vm_flags |= VM_CAN_NONLINEAR;
1200
1194 return 0; 1201 return 0;
1195} 1202}
1196 1203