Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1391282

[PATCH v5 1/2] dax: Don't touch i_dio_count in dax_do_io()

From Waiman Long <Waiman.Long@hpe.com>
Newsgroups linux.kernel
Subject [PATCH v5 1/2] dax: Don't touch i_dio_count in dax_do_io()
Date 2016-04-29 18:40 +0200
Message-ID <rtjCp-LR-1@gated-at.bofh.it> (permalink)
References <rtjsK-HD-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v5 0/2] ext4: Improve parallel I/O performance on NVDIMM Waiman Long <Waiman.Long@hpe.com> - 2016-04-29 18:30 +0200
  [PATCH v5 1/2] dax: Don't touch i_dio_count in dax_do_io() Waiman Long <Waiman.Long@hpe.com> - 2016-04-29 18:40 +0200
    Re: [PATCH v5 1/2] dax: Don't touch i_dio_count in dax_do_io() Jan Kara <jack@suse.cz> - 2016-05-05 16:20 +0200
      Re: [PATCH v5 1/2] dax: Don't touch i_dio_count in dax_do_io() Christoph Hellwig <hch@infradead.org> - 2016-05-05 16:30 +0200
        Re: [PATCH v5 1/2] dax: Don't touch i_dio_count in dax_do_io() Jan Kara <jack@suse.cz> - 2016-05-05 17:50 +0200
  Re: [PATCH v5 0/2] ext4: Improve parallel I/O performance on NVDIMM Waiman Long <waiman.long@hpe.com> - 2016-04-29 18:40 +0200
    Re: [PATCH v5 0/2] ext4: Improve parallel I/O performance on NVDIMM Christoph Hellwig <hch@infradead.org> - 2016-05-01 19:30 +0200
      Re: [PATCH v5 0/2] ext4: Improve parallel I/O performance on NVDIMM Waiman Long <waiman.long@hpe.com> - 2016-05-02 19:50 +0200
      Re: [PATCH v5 0/2] ext4: Improve parallel I/O performance on NVDIMM Dave Chinner <david@fromorbit.com> - 2016-05-05 04:00 +0200
        Re: [PATCH v5 0/2] ext4: Improve parallel I/O performance on NVDIMM Christoph Hellwig <hch@infradead.org> - 2016-05-05 16:20 +0200
  [PATCH v5 2/2] ext4: Make cache hits/misses per-cpu counts Waiman Long <Waiman.Long@hpe.com> - 2016-04-29 18:40 +0200
    Re: [PATCH v5 2/2] ext4: Make cache hits/misses per-cpu counts Jan Kara <jack@suse.cz> - 2016-05-05 16:10 +0200

csiph-web