From: Dan Williams Subject: Re: [PATCH 19/19] xfs: Add support for MAP_SYNC flag Date: Wed, 11 Oct 2017 15:54:51 -0700 Message-ID: References: <20171011200603.27442-1-jack@suse.cz> <20171011200603.27442-20-jack@suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: linux-fsdevel , linux-ext4 , linux-xfs@vger.kernel.org, Christoph Hellwig , Ross Zwisler , Ted Tso , "Darrick J. Wong" To: Jan Kara Return-path: Received: from mail-oi0-f44.google.com ([209.85.218.44]:50262 "EHLO mail-oi0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750778AbdJKWyw (ORCPT ); Wed, 11 Oct 2017 18:54:52 -0400 Received: by mail-oi0-f44.google.com with SMTP id q4so5691266oic.7 for ; Wed, 11 Oct 2017 15:54:51 -0700 (PDT) In-Reply-To: <20171011200603.27442-20-jack@suse.cz> Sender: linux-ext4-owner@vger.kernel.org List-ID: On Wed, Oct 11, 2017 at 1:06 PM, Jan Kara wrote: > Now when everything is prepared, add support in xfs to accept MAP_SYNC > as an mmap(2) flag. > > Signed-off-by: Jan Kara > --- > fs/ext4/file.c | 1 + > fs/xfs/xfs_file.c | 23 +++++++++++++++++++++++ > 2 files changed, 24 insertions(+) > > diff --git a/fs/ext4/file.c b/fs/ext4/file.c > index f013cda84b3d..6b597cc6b29d 100644 > --- a/fs/ext4/file.c > +++ b/fs/ext4/file.c > @@ -26,6 +26,7 @@ > #include > #include > #include > +#include > #include "ext4.h" > #include "ext4_jbd2.h" > #include "xattr.h" > diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c > index c45f24ffab22..fb135224476d 100644 > --- a/fs/xfs/xfs_file.c > +++ b/fs/xfs/xfs_file.c > @@ -44,6 +44,7 @@ > #include > #include > #include > +#include > > static const struct vm_operations_struct xfs_file_vm_ops; > > @@ -1142,6 +1143,27 @@ xfs_file_mmap( > return 0; > } > > +#define XFS_MAP_SUPPORTED (LEGACY_MAP_MASK | MAP_SYNC) > + > +static int > +xfs_file_mmap_validate( > + struct file *filp, > + struct vm_area_struct *vma, > + unsigned long map_flags) > +{ > + if (map_flags & ~XFS_MAP_SUPPORTED) > + return -EOPNOTSUPP; > + > + /* > + * We don't support synchronous mappings for non-DAX files. At least > + * until someone comes with a sensible use case. > + */ > + if (!IS_DAX(file_inode(filp)) && (map_flags & MAP_SYNC)) > + return -EOPNOTSUPP; Same comment about using EPERM here. That's also what I'm returning in the MAP_DIRECT case when the inode is a reflink inode and does not support MAP_DIRECT.