[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200227052442.22524-5-ira.weiny@intel.com>
Date: Wed, 26 Feb 2020 21:24:34 -0800
From: ira.weiny@...el.com
To: linux-kernel@...r.kernel.org
Cc: Ira Weiny <ira.weiny@...el.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
"Darrick J. Wong" <darrick.wong@...cle.com>,
Dan Williams <dan.j.williams@...el.com>,
Dave Chinner <david@...morbit.com>,
Christoph Hellwig <hch@....de>,
"Theodore Y. Ts'o" <tytso@....edu>, Jan Kara <jack@...e.cz>,
linux-ext4@...r.kernel.org, linux-xfs@...r.kernel.org,
linux-fsdevel@...r.kernel.org
Subject: [PATCH V5 04/12] fs/xfs: Isolate the physical DAX flag from enabled
From: Ira Weiny <ira.weiny@...el.com>
xfs_ioctl_setattr_dax_invalidate() currently checks if the DAX flag is
changing as a quick check.
But the implementation mixes the physical (XFS_DIFLAG2_DAX) and
the enabled (S_DAX) DAX flags.
Remove the use of the enabled flag when determining if a change of the
physical flag is required.
Furthermore, we want the physical flag, XFS_DIFLAG2_DAX, to be changed
regardless of if the underlying storage can support DAX or not.
The enabled flag, IS_DAX(), will be set later IFF the inode supports
dax in a follow on patch.
Signed-off-by: Ira Weiny <ira.weiny@...el.com>
---
Changes from V3:
Remove the underlying storage support check
Rework commit message
Reorder patch
---
fs/xfs/xfs_ioctl.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index d42de92cb283..25e12ce85075 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -1190,28 +1190,16 @@ xfs_ioctl_setattr_dax_invalidate(
int *join_flags)
{
struct inode *inode = VFS_I(ip);
- struct super_block *sb = inode->i_sb;
int error;
*join_flags = 0;
- /*
- * It is only valid to set the DAX flag on regular files and
- * directories on filesystems where the block size is equal to the page
- * size. On directories it serves as an inherited hint so we don't
- * have to check the device for dax support or flush pagecache.
- */
- if (fa->fsx_xflags & FS_XFLAG_DAX) {
- struct xfs_buftarg *target = xfs_inode_buftarg(ip);
-
- if (!bdev_dax_supported(target->bt_bdev, sb->s_blocksize))
- return -EINVAL;
- }
-
/* If the DAX state is not changing, we have nothing to do here. */
- if ((fa->fsx_xflags & FS_XFLAG_DAX) && IS_DAX(inode))
+ if ((fa->fsx_xflags & FS_XFLAG_DAX) &&
+ (ip->i_d.di_flags2 & XFS_DIFLAG2_DAX))
return 0;
- if (!(fa->fsx_xflags & FS_XFLAG_DAX) && !IS_DAX(inode))
+ if (!(fa->fsx_xflags & FS_XFLAG_DAX) &&
+ !(ip->i_d.di_flags2 & XFS_DIFLAG2_DAX))
return 0;
if (S_ISDIR(inode->i_mode))
--
2.21.0
Powered by blists - more mailing lists