Skip to content

Commit

Permalink
Btrfs: fix remap_file_pages error
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Miao Xie authored and Chris Mason committed Jun 11, 2010
1 parent 0e4dcbe commit 058a457
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion fs/btrfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 058a457

Please sign in to comment.