* [PATCH v3 4/5] ext4: disable map_sync for virtio pmem
@ 2019-01-09 13:56 Pankaj Gupta
0 siblings, 0 replies; 11+ messages in thread
From: Pankaj Gupta @ 2019-01-09 13:56 UTC (permalink / raw)
To: linux-kernel, kvm, qemu-devel, linux-nvdimm, linux-fsdevel,
virtualization, linux-acpi, linux-ext4, linux-xfs
Cc: pagupta, jack, lcapitulino, adilger.kernel, zwisler, eblake,
dave.jiang, darrick.wong, vishal.l.verma, mst, willy, hch,
jmoyer, nilal, riel, stefanha, imammedo, dan.j.williams, tytso,
xiaoguangrong.eric, rjw, pbonzini
Virtio pmem provides asynchronous host page cache flush
mechanism. We don't support 'MAP_SYNC' with virtio pmem
and ext4.
Signed-off-by: Pankaj Gupta <pagupta@redhat.com>
---
fs/ext4/file.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 69d65d4..e54f48b 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -360,8 +360,10 @@ static const struct vm_operations_struct ext4_file_vm_ops = {
static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
{
struct inode *inode = file->f_mapping->host;
+ struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+ struct dax_device *dax_dev = sbi->s_daxdev;
- if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
+ if (unlikely(ext4_forced_shutdown(sbi)))
return -EIO;
/*
@@ -371,6 +373,13 @@ static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
if (!IS_DAX(file_inode(file)) && (vma->vm_flags & VM_SYNC))
return -EOPNOTSUPP;
+ /* We don't support synchronous mappings with guest direct access
+ * and virtio based host page cache flush mechanism.
+ */
+ if (IS_DAX(file_inode(file)) && virtio_pmem_host_cache_enabled(dax_dev)
+ && (vma->vm_flags & VM_SYNC))
+ return -EOPNOTSUPP;
+
file_accessed(file);
if (IS_DAX(file_inode(file))) {
vma->vm_ops = &ext4_dax_vm_ops;
--
2.9.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v3 4/5] ext4: disable map_sync for virtio pmem
2019-01-09 14:42 ` Jan Kara
(?)
@ 2019-01-09 14:54 ` Pankaj Gupta
-1 siblings, 0 replies; 11+ messages in thread
From: Pankaj Gupta @ 2019-01-09 14:54 UTC (permalink / raw)
To: Jan Kara
Cc: linux-kernel, kvm, qemu-devel, linux-nvdimm, linux-fsdevel,
virtualization, linux-acpi, linux-ext4, linux-xfs, stefanha,
dan j williams, riel, nilal, kwolf, pbonzini, zwisler,
vishal l verma, dave jiang, david, jmoyer, xiaoguangrong eric,
hch, mst, jasowang, lcapitulino, imammedo, eblake, willy, tytso,
adilger kernel
>
> On Wed 09-01-19 19:26:05, Pankaj Gupta wrote:
> > Virtio pmem provides asynchronous host page cache flush
> > mechanism. We don't support 'MAP_SYNC' with virtio pmem
> > and ext4.
> >
> > Signed-off-by: Pankaj Gupta <pagupta@redhat.com>
> ...
> > @@ -371,6 +373,13 @@ static int ext4_file_mmap(struct file *file, struct
> > vm_area_struct *vma)
> > if (!IS_DAX(file_inode(file)) && (vma->vm_flags & VM_SYNC))
> > return -EOPNOTSUPP;
> >
> > + /* We don't support synchronous mappings with guest direct access
> > + * and virtio based host page cache flush mechanism.
> > + */
> > + if (IS_DAX(file_inode(file)) && virtio_pmem_host_cache_enabled(dax_dev)
> > + && (vma->vm_flags & VM_SYNC))
> > + return -EOPNOTSUPP;
> > +
>
> Shouldn't there rather be some generic way of doing this? Having
> virtio_pmem_host_cache_enabled() check in filesystem code just looks like
> filesystem sniffing into details is should not care about... Maybe just
> naming this (or having a wrapper) dax_dev_map_sync_supported()?
Thanks for the feedback.
Just wanted to avoid 'dax' in function name just to differentiate this with real dax.
But yes can add a wrapper: dax_dev_map_sync_supported()
Thanks,
Pankaj
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 4/5] ext4: disable map_sync for virtio pmem
@ 2019-01-09 14:54 ` Pankaj Gupta
0 siblings, 0 replies; 11+ messages in thread
From: Pankaj Gupta @ 2019-01-09 14:54 UTC (permalink / raw)
To: Jan Kara
Cc: linux-kernel, kvm, qemu-devel, linux-nvdimm, linux-fsdevel,
virtualization, linux-acpi, linux-ext4, linux-xfs, stefanha,
dan j williams, riel, nilal, kwolf, pbonzini, zwisler,
vishal l verma, dave jiang, david, jmoyer, xiaoguangrong eric,
hch, mst, jasowang, lcapitulino, imammedo, eblake, willy, tytso,
adilger kernel, darrick wong, rjw
>
> On Wed 09-01-19 19:26:05, Pankaj Gupta wrote:
> > Virtio pmem provides asynchronous host page cache flush
> > mechanism. We don't support 'MAP_SYNC' with virtio pmem
> > and ext4.
> >
> > Signed-off-by: Pankaj Gupta <pagupta@redhat.com>
> ...
> > @@ -371,6 +373,13 @@ static int ext4_file_mmap(struct file *file, struct
> > vm_area_struct *vma)
> > if (!IS_DAX(file_inode(file)) && (vma->vm_flags & VM_SYNC))
> > return -EOPNOTSUPP;
> >
> > + /* We don't support synchronous mappings with guest direct access
> > + * and virtio based host page cache flush mechanism.
> > + */
> > + if (IS_DAX(file_inode(file)) && virtio_pmem_host_cache_enabled(dax_dev)
> > + && (vma->vm_flags & VM_SYNC))
> > + return -EOPNOTSUPP;
> > +
>
> Shouldn't there rather be some generic way of doing this? Having
> virtio_pmem_host_cache_enabled() check in filesystem code just looks like
> filesystem sniffing into details is should not care about... Maybe just
> naming this (or having a wrapper) dax_dev_map_sync_supported()?
Thanks for the feedback.
Just wanted to avoid 'dax' in function name just to differentiate this with real dax.
But yes can add a wrapper: dax_dev_map_sync_supported()
Thanks,
Pankaj
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 4/5] ext4: disable map_sync for virtio pmem
@ 2019-01-09 14:54 ` Pankaj Gupta
0 siblings, 0 replies; 11+ messages in thread
From: Pankaj Gupta @ 2019-01-09 14:54 UTC (permalink / raw)
To: Jan Kara
Cc: linux-kernel, kvm, qemu-devel, linux-nvdimm, linux-fsdevel,
virtualization, linux-acpi, linux-ext4, linux-xfs, stefanha,
dan j williams, riel, nilal, kwolf, pbonzini, zwisler,
vishal l verma, dave jiang, david, jmoyer, xiaoguangrong eric,
hch, mst, jasowang, lcapitulino, imammedo, eblake, willy, tytso,
adilger kernel
>
> On Wed 09-01-19 19:26:05, Pankaj Gupta wrote:
> > Virtio pmem provides asynchronous host page cache flush
> > mechanism. We don't support 'MAP_SYNC' with virtio pmem
> > and ext4.
> >
> > Signed-off-by: Pankaj Gupta <pagupta@redhat.com>
> ...
> > @@ -371,6 +373,13 @@ static int ext4_file_mmap(struct file *file, struct
> > vm_area_struct *vma)
> > if (!IS_DAX(file_inode(file)) && (vma->vm_flags & VM_SYNC))
> > return -EOPNOTSUPP;
> >
> > + /* We don't support synchronous mappings with guest direct access
> > + * and virtio based host page cache flush mechanism.
> > + */
> > + if (IS_DAX(file_inode(file)) && virtio_pmem_host_cache_enabled(dax_dev)
> > + && (vma->vm_flags & VM_SYNC))
> > + return -EOPNOTSUPP;
> > +
>
> Shouldn't there rather be some generic way of doing this? Having
> virtio_pmem_host_cache_enabled() check in filesystem code just looks like
> filesystem sniffing into details is should not care about... Maybe just
> naming this (or having a wrapper) dax_dev_map_sync_supported()?
Thanks for the feedback.
Just wanted to avoid 'dax' in function name just to differentiate this with real dax.
But yes can add a wrapper: dax_dev_map_sync_supported()
Thanks,
Pankaj
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 4/5] ext4: disable map_sync for virtio pmem
2019-01-09 14:42 ` Jan Kara
(?)
@ 2019-01-09 14:54 ` Pankaj Gupta
-1 siblings, 0 replies; 11+ messages in thread
From: Pankaj Gupta @ 2019-01-09 14:54 UTC (permalink / raw)
To: Jan Kara
Cc: kvm, linux-nvdimm, qemu-devel, virtualization, adilger kernel,
zwisler, eblake, dave jiang, darrick wong, vishal l verma, mst,
willy, hch, linux-acpi, jmoyer, nilal, riel, stefanha, imammedo,
dan j williams, lcapitulino, linux-ext4, tytso,
xiaoguangrong eric, rjw, linux-kernel, linux-xfs, linux-fsdevel,
pbonzini
>
> On Wed 09-01-19 19:26:05, Pankaj Gupta wrote:
> > Virtio pmem provides asynchronous host page cache flush
> > mechanism. We don't support 'MAP_SYNC' with virtio pmem
> > and ext4.
> >
> > Signed-off-by: Pankaj Gupta <pagupta@redhat.com>
> ...
> > @@ -371,6 +373,13 @@ static int ext4_file_mmap(struct file *file, struct
> > vm_area_struct *vma)
> > if (!IS_DAX(file_inode(file)) && (vma->vm_flags & VM_SYNC))
> > return -EOPNOTSUPP;
> >
> > + /* We don't support synchronous mappings with guest direct access
> > + * and virtio based host page cache flush mechanism.
> > + */
> > + if (IS_DAX(file_inode(file)) && virtio_pmem_host_cache_enabled(dax_dev)
> > + && (vma->vm_flags & VM_SYNC))
> > + return -EOPNOTSUPP;
> > +
>
> Shouldn't there rather be some generic way of doing this? Having
> virtio_pmem_host_cache_enabled() check in filesystem code just looks like
> filesystem sniffing into details is should not care about... Maybe just
> naming this (or having a wrapper) dax_dev_map_sync_supported()?
Thanks for the feedback.
Just wanted to avoid 'dax' in function name just to differentiate this with real dax.
But yes can add a wrapper: dax_dev_map_sync_supported()
Thanks,
Pankaj
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 4/5] ext4: disable map_sync for virtio pmem
2019-01-09 14:47 [PATCH v3 0/5] kvm "virtio pmem" device Pankaj Gupta
2019-01-09 14:47 ` [PATCH v3 4/5] ext4: disable map_sync for virtio pmem Pankaj Gupta
@ 2019-01-09 14:47 ` Pankaj Gupta
1 sibling, 0 replies; 11+ messages in thread
From: Pankaj Gupta @ 2019-01-09 14:47 UTC (permalink / raw)
To: linux-kernel, kvm, qemu-devel, linux-nvdimm, linux-fsdevel,
virtualization, linux-acpi, linux-ext4, linux-xfs
Cc: jack, stefanha, dan.j.williams, riel, nilal, kwolf, pbonzini,
zwisler, vishal.l.verma, dave.jiang, david, jmoyer,
xiaoguangrong.eric, hch, mst, jasowang, lcapitulino, imammedo,
eblake, willy, tytso, adilger.kernel, darrick.wong, rjw, pagupta
Virtio pmem provides asynchronous host page cache flush
mechanism. We don't support 'MAP_SYNC' with virtio pmem
and ext4.
Signed-off-by: Pankaj Gupta <pagupta@redhat.com>
---
fs/ext4/file.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 69d65d4..e54f48b 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -360,8 +360,10 @@ static const struct vm_operations_struct ext4_file_vm_ops = {
static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
{
struct inode *inode = file->f_mapping->host;
+ struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+ struct dax_device *dax_dev = sbi->s_daxdev;
- if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
+ if (unlikely(ext4_forced_shutdown(sbi)))
return -EIO;
/*
@@ -371,6 +373,13 @@ static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
if (!IS_DAX(file_inode(file)) && (vma->vm_flags & VM_SYNC))
return -EOPNOTSUPP;
+ /* We don't support synchronous mappings with guest direct access
+ * and virtio based host page cache flush mechanism.
+ */
+ if (IS_DAX(file_inode(file)) && virtio_pmem_host_cache_enabled(dax_dev)
+ && (vma->vm_flags & VM_SYNC))
+ return -EOPNOTSUPP;
+
file_accessed(file);
if (IS_DAX(file_inode(file))) {
vma->vm_ops = &ext4_dax_vm_ops;
--
2.9.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 4/5] ext4: disable map_sync for virtio pmem
2019-01-09 14:47 [PATCH v3 0/5] kvm "virtio pmem" device Pankaj Gupta
@ 2019-01-09 14:47 ` Pankaj Gupta
2019-01-09 14:47 ` Pankaj Gupta
1 sibling, 0 replies; 11+ messages in thread
From: Pankaj Gupta @ 2019-01-09 14:47 UTC (permalink / raw)
To: linux-kernel, kvm, qemu-devel, linux-nvdimm, linux-fsdevel,
virtualization, linux-acpi, linux-ext4, linux-xfs
Cc: pagupta, jack, lcapitulino, adilger.kernel, zwisler, eblake,
dave.jiang, darrick.wong, vishal.l.verma, mst, willy, hch,
jmoyer, nilal, riel, stefanha, imammedo, dan.j.williams, tytso,
xiaoguangrong.eric, rjw, pbonzini
Virtio pmem provides asynchronous host page cache flush
mechanism. We don't support 'MAP_SYNC' with virtio pmem
and ext4.
Signed-off-by: Pankaj Gupta <pagupta@redhat.com>
---
fs/ext4/file.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 69d65d4..e54f48b 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -360,8 +360,10 @@ static const struct vm_operations_struct ext4_file_vm_ops = {
static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
{
struct inode *inode = file->f_mapping->host;
+ struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+ struct dax_device *dax_dev = sbi->s_daxdev;
- if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
+ if (unlikely(ext4_forced_shutdown(sbi)))
return -EIO;
/*
@@ -371,6 +373,13 @@ static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
if (!IS_DAX(file_inode(file)) && (vma->vm_flags & VM_SYNC))
return -EOPNOTSUPP;
+ /* We don't support synchronous mappings with guest direct access
+ * and virtio based host page cache flush mechanism.
+ */
+ if (IS_DAX(file_inode(file)) && virtio_pmem_host_cache_enabled(dax_dev)
+ && (vma->vm_flags & VM_SYNC))
+ return -EOPNOTSUPP;
+
file_accessed(file);
if (IS_DAX(file_inode(file))) {
vma->vm_ops = &ext4_dax_vm_ops;
--
2.9.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v3 4/5] ext4: disable map_sync for virtio pmem
2019-01-09 13:56 ` Pankaj Gupta
@ 2019-01-09 14:42 ` Jan Kara
-1 siblings, 0 replies; 11+ messages in thread
From: Jan Kara @ 2019-01-09 14:42 UTC (permalink / raw)
To: Pankaj Gupta
Cc: jack, kvm, linux-nvdimm, qemu-devel, virtualization,
adilger.kernel, zwisler, eblake, dave.jiang, darrick.wong,
vishal.l.verma, mst, willy, hch, linux-acpi, jmoyer, nilal, riel,
stefanha, imammedo, dan.j.williams, lcapitulino, linux-ext4,
tytso, xiaoguangrong.eric, rjw, linux-kernel, linux-xfs,
linux-fsdevel, pbonzini
On Wed 09-01-19 19:26:05, Pankaj Gupta wrote:
> Virtio pmem provides asynchronous host page cache flush
> mechanism. We don't support 'MAP_SYNC' with virtio pmem
> and ext4.
>
> Signed-off-by: Pankaj Gupta <pagupta@redhat.com>
...
> @@ -371,6 +373,13 @@ static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
> if (!IS_DAX(file_inode(file)) && (vma->vm_flags & VM_SYNC))
> return -EOPNOTSUPP;
>
> + /* We don't support synchronous mappings with guest direct access
> + * and virtio based host page cache flush mechanism.
> + */
> + if (IS_DAX(file_inode(file)) && virtio_pmem_host_cache_enabled(dax_dev)
> + && (vma->vm_flags & VM_SYNC))
> + return -EOPNOTSUPP;
> +
Shouldn't there rather be some generic way of doing this? Having
virtio_pmem_host_cache_enabled() check in filesystem code just looks like
filesystem sniffing into details is should not care about... Maybe just
naming this (or having a wrapper) dax_dev_map_sync_supported()?
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 4/5] ext4: disable map_sync for virtio pmem
@ 2019-01-09 14:42 ` Jan Kara
0 siblings, 0 replies; 11+ messages in thread
From: Jan Kara @ 2019-01-09 14:42 UTC (permalink / raw)
To: Pankaj Gupta
Cc: linux-kernel, kvm, qemu-devel, linux-nvdimm, linux-fsdevel,
virtualization, linux-acpi, linux-ext4, linux-xfs, jack,
stefanha, dan.j.williams, riel, nilal, kwolf, pbonzini, zwisler,
vishal.l.verma, dave.jiang, david, jmoyer, xiaoguangrong.eric,
hch, mst, jasowang, lcapitulino, imammedo, eblake, willy, tytso,
adilger.kernel, darrick.wong, rjw
On Wed 09-01-19 19:26:05, Pankaj Gupta wrote:
> Virtio pmem provides asynchronous host page cache flush
> mechanism. We don't support 'MAP_SYNC' with virtio pmem
> and ext4.
>
> Signed-off-by: Pankaj Gupta <pagupta@redhat.com>
...
> @@ -371,6 +373,13 @@ static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
> if (!IS_DAX(file_inode(file)) && (vma->vm_flags & VM_SYNC))
> return -EOPNOTSUPP;
>
> + /* We don't support synchronous mappings with guest direct access
> + * and virtio based host page cache flush mechanism.
> + */
> + if (IS_DAX(file_inode(file)) && virtio_pmem_host_cache_enabled(dax_dev)
> + && (vma->vm_flags & VM_SYNC))
> + return -EOPNOTSUPP;
> +
Shouldn't there rather be some generic way of doing this? Having
virtio_pmem_host_cache_enabled() check in filesystem code just looks like
filesystem sniffing into details is should not care about... Maybe just
naming this (or having a wrapper) dax_dev_map_sync_supported()?
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 4/5] ext4: disable map_sync for virtio pmem
@ 2019-01-09 13:56 ` Pankaj Gupta
0 siblings, 0 replies; 11+ messages in thread
From: Pankaj Gupta @ 2019-01-09 13:56 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA, kvm-u79uwXL29TY76Z2rM5mHXA,
qemu-devel-qX2TKyscuCcdnm+yROfE0A,
linux-nvdimm-y27Ovi1pjclAfugRpC6u6w,
linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-acpi-u79uwXL29TY76Z2rM5mHXA,
linux-ext4-u79uwXL29TY76Z2rM5mHXA,
linux-xfs-u79uwXL29TY76Z2rM5mHXA
Cc: jack-AlSwsSmVLrQ, david-H+wXaHxf7aLQT0dZR+AlfA,
jasowang-H+wXaHxf7aLQT0dZR+AlfA,
lcapitulino-H+wXaHxf7aLQT0dZR+AlfA,
adilger.kernel-m1MBpc4rdrD3fQ9qLvQP4Q,
zwisler-DgEjT+Ai2ygdnm+yROfE0A, eblake-H+wXaHxf7aLQT0dZR+AlfA,
darrick.wong-QHcLZuEGTsvQT0dZR+AlfA, mst-H+wXaHxf7aLQT0dZR+AlfA,
willy-wEGCiKHe2LqWVfeAwA7xHQ, hch-wEGCiKHe2LqWVfeAwA7xHQ,
nilal-H+wXaHxf7aLQT0dZR+AlfA, riel-ebMLmSuQjDVBDgjK7y7TUQ,
stefanha-H+wXaHxf7aLQT0dZR+AlfA, imammedo-H+wXaHxf7aLQT0dZR+AlfA,
kwolf-H+wXaHxf7aLQT0dZR+AlfA, tytso-3s7WtUTddSA,
xiaoguangrong.eric-Re5JQEeQqe8AvxtiuMwx3w,
rjw-LthD3rsA81gm4RdzfppkhA, pbonzini-H+wXaHxf7aLQT0dZR+AlfA
Virtio pmem provides asynchronous host page cache flush
mechanism. We don't support 'MAP_SYNC' with virtio pmem
and ext4.
Signed-off-by: Pankaj Gupta <pagupta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
fs/ext4/file.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 69d65d4..e54f48b 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -360,8 +360,10 @@ static const struct vm_operations_struct ext4_file_vm_ops = {
static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
{
struct inode *inode = file->f_mapping->host;
+ struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+ struct dax_device *dax_dev = sbi->s_daxdev;
- if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
+ if (unlikely(ext4_forced_shutdown(sbi)))
return -EIO;
/*
@@ -371,6 +373,13 @@ static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
if (!IS_DAX(file_inode(file)) && (vma->vm_flags & VM_SYNC))
return -EOPNOTSUPP;
+ /* We don't support synchronous mappings with guest direct access
+ * and virtio based host page cache flush mechanism.
+ */
+ if (IS_DAX(file_inode(file)) && virtio_pmem_host_cache_enabled(dax_dev)
+ && (vma->vm_flags & VM_SYNC))
+ return -EOPNOTSUPP;
+
file_accessed(file);
if (IS_DAX(file_inode(file))) {
vma->vm_ops = &ext4_dax_vm_ops;
--
2.9.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 4/5] ext4: disable map_sync for virtio pmem
@ 2019-01-09 13:56 ` Pankaj Gupta
0 siblings, 0 replies; 11+ messages in thread
From: Pankaj Gupta @ 2019-01-09 13:56 UTC (permalink / raw)
To: linux-kernel, kvm, qemu-devel, linux-nvdimm, linux-fsdevel,
virtualization, linux-acpi, linux-ext4, linux-xfs
Cc: jack, stefanha, dan.j.williams, riel, nilal, kwolf, pbonzini,
zwisler, vishal.l.verma, dave.jiang, david, jmoyer,
xiaoguangrong.eric, hch, mst, jasowang, lcapitulino, imammedo,
eblake, willy, tytso, adilger.kernel, darrick.wong, rjw, pagupta
Virtio pmem provides asynchronous host page cache flush
mechanism. We don't support 'MAP_SYNC' with virtio pmem
and ext4.
Signed-off-by: Pankaj Gupta <pagupta@redhat.com>
---
fs/ext4/file.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 69d65d4..e54f48b 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -360,8 +360,10 @@ static const struct vm_operations_struct ext4_file_vm_ops = {
static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
{
struct inode *inode = file->f_mapping->host;
+ struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+ struct dax_device *dax_dev = sbi->s_daxdev;
- if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
+ if (unlikely(ext4_forced_shutdown(sbi)))
return -EIO;
/*
@@ -371,6 +373,13 @@ static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
if (!IS_DAX(file_inode(file)) && (vma->vm_flags & VM_SYNC))
return -EOPNOTSUPP;
+ /* We don't support synchronous mappings with guest direct access
+ * and virtio based host page cache flush mechanism.
+ */
+ if (IS_DAX(file_inode(file)) && virtio_pmem_host_cache_enabled(dax_dev)
+ && (vma->vm_flags & VM_SYNC))
+ return -EOPNOTSUPP;
+
file_accessed(file);
if (IS_DAX(file_inode(file))) {
vma->vm_ops = &ext4_dax_vm_ops;
--
2.9.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2019-01-09 14:54 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-09 13:56 [PATCH v3 4/5] ext4: disable map_sync for virtio pmem Pankaj Gupta
-- strict thread matches above, loose matches on Subject: below --
2019-01-09 14:47 [PATCH v3 0/5] kvm "virtio pmem" device Pankaj Gupta
2019-01-09 14:47 ` [PATCH v3 4/5] ext4: disable map_sync for virtio pmem Pankaj Gupta
2019-01-09 14:47 ` Pankaj Gupta
2019-01-09 13:56 Pankaj Gupta
2019-01-09 13:56 ` Pankaj Gupta
2019-01-09 14:42 ` Jan Kara
2019-01-09 14:42 ` Jan Kara
2019-01-09 14:54 ` Pankaj Gupta
2019-01-09 14:54 ` Pankaj Gupta
2019-01-09 14:54 ` Pankaj Gupta
2019-01-09 14:54 ` Pankaj Gupta
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.