diff mbox

[v2] dax: allow MAP_SYNC for device-dax mmap() to succeed

Message ID 152417033504.18702.8933921557309052260.stgit@djiang5-desk3.ch.intel.com
State New, archived
Headers show

Commit Message

Dave Jiang April 19, 2018, 8:39 p.m. UTC
MAP_SYNC is a nop for device-dax. Allow MAP_SYNC to succeed on device-dax
to eliminate special casing between device-dax and fs-dax as to when the
flag can be specified. Device-dax users already implicitly assume that they do
not need to call fsync(), and this enables them to explicitly check for this
capability.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---

v2: update commit message with suggestion from Dan.

 drivers/dax/device.c |    2 ++
 1 file changed, 2 insertions(+)

Comments

Dan Williams April 19, 2018, 9:08 p.m. UTC | #1
On Thu, Apr 19, 2018 at 1:39 PM, Dave Jiang <dave.jiang@intel.com> wrote:
> MAP_SYNC is a nop for device-dax. Allow MAP_SYNC to succeed on device-dax
> to eliminate special casing between device-dax and fs-dax as to when the
> flag can be specified. Device-dax users already implicitly assume that they do
> not need to call fsync(), and this enables them to explicitly check for this
> capability.
>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
>
> v2: update commit message with suggestion from Dan.

Looks good,

Reviewed-by: Dan Williams <dan.j.williams@intel.com>
diff mbox

Patch

diff --git a/drivers/dax/device.c b/drivers/dax/device.c
index 37be5a306c8f..374b6718f6c5 100644
--- a/drivers/dax/device.c
+++ b/drivers/dax/device.c
@@ -19,6 +19,7 @@ 
 #include <linux/dax.h>
 #include <linux/fs.h>
 #include <linux/mm.h>
+#include <linux/mman.h>
 #include "dax-private.h"
 #include "dax.h"
 
@@ -530,6 +531,7 @@  static const struct file_operations dax_fops = {
 	.release = dax_release,
 	.get_unmapped_area = dax_get_unmapped_area,
 	.mmap = dax_mmap,
+	.mmap_supported_flags = MAP_SYNC,
 };
 
 static void dev_dax_release(struct device *dev)