linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: linux-xfs@vger.kernel.org
Cc: david@fromorbit.com
Subject: [PATCH 2/3] xfs: don't start out with the exclusive ilock for direct I/O
Date: Wed, 28 Feb 2018 09:45:51 -0800	[thread overview]
Message-ID: <20180228174552.31919-3-hch@lst.de> (raw)
In-Reply-To: <20180228174552.31919-1-hch@lst.de>

There is no reason to take the ilock exclusively at the start of
xfs_file_iomap_begin for direct I/O, given that it will be demoted
just before calling xfs_iomap_write_direct anyway.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_iomap.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 4e771e0f1170..ee01859b77a5 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -965,13 +965,11 @@ static inline bool needs_cow_for_zeroing(struct xfs_bmbt_irec *imap, int nimaps)
 static inline bool need_excl_ilock(struct xfs_inode *ip, unsigned flags)
 {
 	/*
-	 * COW writes will allocate delalloc space, so we need to make sure
-	 * to take the lock exclusively here.
+	 * COW writes may allocate delalloc space or convert unwritten COW
+	 * extents, so we need to make sure to take the lock exclusively here.
 	 */
 	if (xfs_is_reflink_inode(ip) && (flags & (IOMAP_WRITE | IOMAP_ZERO)))
 		return true;
-	if ((flags & IOMAP_DIRECT) && (flags & IOMAP_WRITE))
-		return true;
 	return false;
 }
 
-- 
2.14.2


  parent reply	other threads:[~2018-02-28 17:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-28 17:45 iomap fixes Christoph Hellwig
2018-02-28 17:45 ` [PATCH 1/3] xfs: don't allocate COW blocks for zeroing holes or unwritten extents Christoph Hellwig
2018-03-01 22:01   ` Dave Chinner
2018-03-01 22:28     ` Darrick J. Wong
2018-02-28 17:45 ` Christoph Hellwig [this message]
2018-03-01 22:02   ` [PATCH 2/3] xfs: don't start out with the exclusive ilock for direct I/O Dave Chinner
2018-02-28 17:45 ` [PATCH 3/3] xfs: don't block on the ilock for RWF_NOWAIT Christoph Hellwig
2018-03-01 22:04   ` 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=20180228174552.31919-3-hch@lst.de \
    --to=hch@lst.de \
    --cc=david@fromorbit.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).