linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 06/10] btrfs: fix remap_file_pages error
@ 2010-05-20  7:21 Miao Xie
  2010-05-20  8:32 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Miao Xie @ 2010-05-20  7:21 UTC (permalink / raw)
  To: Chris Mason; +Cc: Linux Btrfs

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>
---
 fs/btrfs/file.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index d146dde..c874833 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1150,8 +1150,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;
 }
 
-- 
1.6.5.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-05-21  8:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-20  7:21 [PATCH 06/10] btrfs: fix remap_file_pages error Miao Xie
2010-05-20  8:32 ` Christoph Hellwig
2010-05-21  8:54   ` Miao Xie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).