From: Waiman Long <Waiman.Long@hpe.com>
To: "Theodore Ts'o" <tytso@mit.edu>,
Andreas Dilger <adilger.kernel@dilger.ca>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Matthew Wilcox <willy@linux.intel.com>
Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
Dave Chinner <david@fromorbit.com>,
Christoph Hellwig <hch@infradead.org>,
Scott J Norton <scott.norton@hpe.com>,
Douglas Hatch <doug.hatch@hpe.com>,
Toshimitsu Kani <toshi.kani@hpe.com>,
Waiman Long <Waiman.Long@hpe.com>
Subject: [PATCH v5 1/2] dax: Don't touch i_dio_count in dax_do_io()
Date: Fri, 29 Apr 2016 12:27:55 -0400 [thread overview]
Message-ID: <1461947276-25988-2-git-send-email-Waiman.Long@hpe.com> (raw)
In-Reply-To: <1461947276-25988-1-git-send-email-Waiman.Long@hpe.com>
The purpose of the i_dio_count is to protect against truncation while
the I/O operation is in progress. As dax_do_io() only does synchronous
I/O, the locking performed by the caller or within dax_do_io() for
read should be enough to protect it against truncation. There is no
need to touch the i_dio_count.
Eliminating two atomic operations can sometimes give a noticeable
improvement in I/O performance as NVDIMM is much faster than other
disk devices.
Suggested-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Waiman Long <Waiman.Long@hpe.com>
---
fs/dax.c | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/fs/dax.c b/fs/dax.c
index 90322eb..1b4b500 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -253,8 +253,12 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter,
* If @flags has DIO_LOCKING set, we assume that the i_mutex is held by the
* caller for writes. For reads, we take and release the i_mutex ourselves.
* If DIO_LOCKING is not set, the filesystem takes care of its own locking.
- * As with do_blockdev_direct_IO(), we increment i_dio_count while the I/O
- * is in progress.
+ *
+ * The do_blockdev_direct_IO() function increment i_dio_count while the I/O
+ * is in progress. However, the dax_do_io() always does synchronous I/O. The
+ * locking done by the caller or within dax_do_io() for read (DIO_LOCKING)
+ * should be enough to protect against concurrent truncation. We don't really
+ * need to touch i_dio_count here.
*/
ssize_t dax_do_io(struct kiocb *iocb, struct inode *inode,
struct iov_iter *iter, loff_t pos, get_block_t get_block,
@@ -277,10 +281,6 @@ ssize_t dax_do_io(struct kiocb *iocb, struct inode *inode,
}
}
- /* Protects against truncate */
- if (!(flags & DIO_SKIP_DIO_COUNT))
- inode_dio_begin(inode);
-
retval = dax_io(inode, iter, pos, end, get_block, &bh);
if ((flags & DIO_LOCKING) && iov_iter_rw(iter) == READ)
@@ -294,8 +294,6 @@ ssize_t dax_do_io(struct kiocb *iocb, struct inode *inode,
retval = err;
}
- if (!(flags & DIO_SKIP_DIO_COUNT))
- inode_dio_end(inode);
out:
return retval;
}
--
1.7.1
next prev parent reply other threads:[~2016-04-29 16:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-29 16:27 [PATCH v5 0/2] ext4: Improve parallel I/O performance on NVDIMM Waiman Long
2016-04-29 16:27 ` Waiman Long [this message]
2016-05-05 14:16 ` [PATCH v5 1/2] dax: Don't touch i_dio_count in dax_do_io() Jan Kara
2016-05-05 14:27 ` Christoph Hellwig
2016-05-05 15:48 ` Jan Kara
2016-04-29 16:27 ` [PATCH v5 2/2] ext4: Make cache hits/misses per-cpu counts Waiman Long
2016-05-05 14:03 ` Jan Kara
2016-04-29 16:38 ` [PATCH v5 0/2] ext4: Improve parallel I/O performance on NVDIMM Waiman Long
2016-05-01 17:28 ` Christoph Hellwig
2016-05-02 17:45 ` Waiman Long
2016-05-05 1:57 ` Dave Chinner
2016-05-05 14:19 ` Christoph Hellwig
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=1461947276-25988-2-git-send-email-Waiman.Long@hpe.com \
--to=waiman.long@hpe.com \
--cc=adilger.kernel@dilger.ca \
--cc=david@fromorbit.com \
--cc=doug.hatch@hpe.com \
--cc=hch@infradead.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=scott.norton@hpe.com \
--cc=toshi.kani@hpe.com \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@linux.intel.com \
/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
all inboxes | Powered by JetHome®