From: Miao Xie Date: Thu, 20 May 2010 07:21:50 +0000 (+0000) Subject: Btrfs: fix remap_file_pages error X-Git-Tag: v2.6.35-rc3~3^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=058a457ef0ce28d595af53d6103db73332383cbc;p=profile%2Fivi%2Fkernel-x86-ivi.git 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 Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index abcb918..ce0cd29 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 = { static int btrfs_file_mmap(struct file *filp, struct vm_area_struct *vma) { - vma->vm_ops = &btrfs_file_vm_ops; + struct address_space *mapping = filp->f_mapping; + + if (!mapping->a_ops->readpage) + return -ENOEXEC; + file_accessed(filp); + vma->vm_ops = &btrfs_file_vm_ops; + vma->vm_flags |= VM_CAN_NONLINEAR; + return 0; }