On Mon 29-04-19 12:26:43, Goldwyn Rodrigues wrote:
From: Adam Borowski <kilobyte(a)angband.pl>
Used by userspace to detect DAX.
[rgoldwyn(a)suse.com: Added CONFIG_FS_DAX around mmap_supported_flags]
Why the CONFIG_FS_DAX bit? Your mmap(2) implementation understands
implications of MAP_SYNC flag and that's all that's needed to set
.mmap_supported_flags.
Honza
Signed-off-by: Adam Borowski <kilobyte(a)angband.pl>
Signed-off-by: Goldwyn Rodrigues <rgoldwyn(a)suse.com>
---
fs/btrfs/file.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 9d5a3c99a6b9..362a9cf9dcb2 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -16,6 +16,7 @@
#include <linux/btrfs.h>
#include <linux/uio.h>
#include <linux/iversion.h>
+#include <linux/mman.h>
#include "ctree.h"
#include "disk-io.h"
#include "transaction.h"
@@ -3319,6 +3320,9 @@ const struct file_operations btrfs_file_operations = {
.splice_read = generic_file_splice_read,
.write_iter = btrfs_file_write_iter,
.mmap = btrfs_file_mmap,
+#ifdef CONFIG_FS_DAX
+ .mmap_supported_flags = MAP_SYNC,
+#endif
.open = btrfs_file_open,
.release = btrfs_release_file,
.fsync = btrfs_sync_file,
--
2.16.4
--
Jan Kara <jack(a)suse.com>
SUSE Labs, CR