All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 01/10] xfs: don't forbid setting dax flag on directories if device doesn't dax
Date: Sun, 03 Jun 2018 16:22:28 -0700	[thread overview]
Message-ID: <152806814871.18187.4240645095990301961.stgit@magnolia> (raw)
In-Reply-To: <152806814253.18187.4009340462930782844.stgit@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

On a directory, the DAX flag is merely a hint that files created in the
directory should have the DAX flag set at creation time.  We don't care
if the underlying device supports DAX or not because directory metadata
are always cached in DRAM.  We don't care if new files get the flag even
if the device doesn't support DAX because we always check for DAX
support before setting the VFS flag (S_DAX).

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/xfs_ioctl.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)


diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 5dd9e22b4a4c..82f7c83c1dad 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -1098,12 +1098,14 @@ xfs_ioctl_setattr_dax_invalidate(
 	/*
 	 * 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 inherit hint.
+	 * 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) {
 		if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)))
 			return -EINVAL;
-		if (!bdev_dax_supported(xfs_find_bdev_for_inode(VFS_I(ip)),
+		if (S_ISREG(inode->i_mode) &&
+		    !bdev_dax_supported(xfs_find_bdev_for_inode(VFS_I(ip)),
 				sb->s_blocksize))
 			return -EINVAL;
 	}
@@ -1114,6 +1116,9 @@ xfs_ioctl_setattr_dax_invalidate(
 	if (!(fa->fsx_xflags & FS_XFLAG_DAX) && !IS_DAX(inode))
 		return 0;
 
+	if (S_ISDIR(inode->i_mode))
+		return 0;
+
 	/* lock, flush and invalidate mapping in preparation for flag change */
 	xfs_ilock(ip, XFS_MMAPLOCK_EXCL | XFS_IOLOCK_EXCL);
 	error = filemap_write_and_wait(inode->i_mapping);


  reply	other threads:[~2018-06-03 23:22 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-03 23:22 [PATCH 00/10] xfs: fix various checking problems Darrick J. Wong
2018-06-03 23:22 ` Darrick J. Wong [this message]
2018-06-03 23:41   ` [PATCH 01/10] xfs: don't forbid setting dax flag on directories if device doesn't dax Dave Chinner
2018-06-04  4:25     ` Darrick J. Wong
2018-06-03 23:22 ` [PATCH 02/10] xfs: strengthen btree pointer checks before use Darrick J. Wong
2018-06-03 23:45   ` Dave Chinner
2018-06-03 23:22 ` [PATCH 03/10] xfs: don't assert when on-disk btree pointers are garbage Darrick J. Wong
2018-06-03 23:49   ` Dave Chinner
2018-06-03 23:55     ` Dave Chinner
2018-06-03 23:22 ` [PATCH 04/10] xfs: check directory bestfree information in the verifier Darrick J. Wong
2018-06-04  0:10   ` Dave Chinner
2018-06-04  4:23     ` Darrick J. Wong
2018-06-03 23:22 ` [PATCH 05/10] xfs: don't assert when reporting on-disk corruption while loading btree Darrick J. Wong
2018-06-03 23:51   ` Dave Chinner
2018-06-03 23:23 ` [PATCH 06/10] xfs: remove redundant ASSERT on insufficient bestfree length in _leaf_addname Darrick J. Wong
2018-06-04  0:11   ` Dave Chinner
2018-06-03 23:23 ` [PATCH 07/10] xfs: xfs_alloc_get_rec should return EFSCORRUPTED for obvious bnobt corruption Darrick J. Wong
2018-06-04  0:14   ` Dave Chinner
2018-06-04  4:32     ` Darrick J. Wong
2018-06-04 23:22       ` Dave Chinner
2018-06-03 23:23 ` [PATCH 08/10] xfs: btree lookup shouldn't ASSERT on empty btree nodes Darrick J. Wong
2018-06-04  0:14   ` Dave Chinner
2018-06-03 23:23 ` [PATCH 09/10] xfs: don't ASSERT on short form btree root pointer of zero Darrick J. Wong
2018-06-04  0:15   ` Dave Chinner
2018-06-03 23:23 ` [PATCH 10/10] xfs: don't return garbage buffers in xfs_da3_node_read Darrick J. Wong
2018-06-04  0:18   ` Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=152806814871.18187.4240645095990301961.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.