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

* Re: [PATCH 06/10] btrfs: fix remap_file_pages error
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2010-05-20  8:32 UTC (permalink / raw)
  To: Miao Xie; +Cc: Chris Mason, Linux Btrfs

On Thu, May 20, 2010 at 03:21:50PM +0800, Miao Xie wrote:
> +	if (!mapping->a_ops->readpage)
> +		return -ENOEXEC;

I don't think there's any instance of address_space operations without
a readpage method in btrfs.


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

* Re: [PATCH 06/10] btrfs: fix remap_file_pages error
  2010-05-20  8:32 ` Christoph Hellwig
@ 2010-05-21  8:54   ` Miao Xie
  0 siblings, 0 replies; 3+ messages in thread
From: Miao Xie @ 2010-05-21  8:54 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Chris Mason, Linux Btrfs

on 2010-5-20 16:32, Christoph Hellwig wrote:
> On Thu, May 20, 2010 at 03:21:50PM +0800, Miao Xie wrote:
>> +	if (!mapping->a_ops->readpage)
>> +		return -ENOEXEC;
> 
> I don't think there's any instance of address_space operations without
> a readpage method in btrfs.

But, Btrfs is being developing. Maybe someone implement a instance of
address_space without a readpage method in the future. So it is better
to check it, just like ext4.

Thanks


^ permalink raw reply	[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).