All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@fb.com>
To: <linux-kernel@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>
Cc: Jens Axboe <axboe@fb.com>, "Theodore Ts'o" <tytso@mit.edu>
Subject: [PATCH 3/3] ext4: pass in DIO_SKIP_DIO_COUNT to do_blockdev_direct_IO()
Date: Wed, 15 Apr 2015 16:01:38 -0600	[thread overview]
Message-ID: <1429135298-17153-4-git-send-email-axboe@fb.com> (raw)
In-Reply-To: <1429135298-17153-1-git-send-email-axboe@fb.com>

For writes, ext4_ext_direct_IO() already holds the inode i_dio_count
elevated, so we don't need the extra inc/dec that is done in
do_blockdev_direct_IO(). Pass in DIO_SKIP_DIO_COUNT to tell it that.

Cc: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Jens Axboe <axboe@fb.com>
---
 fs/ext4/inode.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 62d4615aa9b0..2605355791a3 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2977,8 +2977,10 @@ static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb,
 	 * conversion. This also disallows race between truncate() and
 	 * overwrite DIO as i_dio_count needs to be incremented under i_mutex.
 	 */
-	if (rw == WRITE)
+	if (rw == WRITE) {
 		inode_dio_inc(inode);
+		dio_flags |= DIO_SKIP_DIO_COUNT;
+	}
 
 	/* If we do a overwrite dio, i_mutex locking can be released */
 	overwrite = *((int *)iocb->private);
@@ -3032,7 +3034,7 @@ static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb,
 		get_block_func = ext4_get_block_write_nolock;
 	} else {
 		get_block_func = ext4_get_block_write;
-		dio_flags = DIO_LOCKING;
+		dio_flags |= DIO_LOCKING;
 	}
 	if (IS_DAX(inode))
 		ret = dax_do_io(rw, iocb, inode, iter, offset, get_block_func,
-- 
1.9.1


  parent reply	other threads:[~2015-04-15 22:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-15 22:01 [PATCH v2] direct-io: only inc/dec inode->i_dio_count for file systems Jens Axboe
2015-04-15 22:01 ` [PATCH 1/3] " Jens Axboe
2015-04-15 22:36   ` Dave Chinner
2015-04-15 22:56     ` Al Viro
2015-04-15 23:05       ` Jens Axboe
2015-04-15 23:30         ` Al Viro
2015-04-15 23:50           ` Jens Axboe
2015-04-15 22:57     ` Jens Axboe
2015-04-15 22:01 ` [PATCH 2/3] btrfs: pass in DIO_SKIP_DIO_COUNT to do_blockdev_direct_IO() Jens Axboe
2015-04-15 22:01 ` Jens Axboe [this message]
2015-04-15 22:05 ` [PATCH v2] direct-io: only inc/dec inode->i_dio_count for file systems Al Viro
2015-04-15 22:06   ` Jens Axboe

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=1429135298-17153-4-git-send-email-axboe@fb.com \
    --to=axboe@fb.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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.