public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Bongio <bongiojp@gmail.com>
To: Ted Tso <tytso@mit.edu>, "Darrick J . Wong" <djwong@kernel.org>,
	Allison Henderson <allison.henderson@oracle.com>
Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-xfs@vger.kernel.org, Jeremy Bongio <bongiojp@gmail.com>
Subject: [PATCH 1/1] For DIO writes with no mapped pages for inode, skip deferring completion.
Date: Wed, 21 Jun 2023 10:29:20 -0700	[thread overview]
Message-ID: <20230621174114.1320834-2-bongiojp@gmail.com> (raw)
In-Reply-To: <20230621174114.1320834-1-bongiojp@gmail.com>

If there are no mapped pages for an DIO write then the page cache does not
need to be updated. For very fast SSDs and direct async IO, deferring work
completion can result in a significant performance loss.
---
 fs/iomap/direct-io.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
index 019cc87d0fb3..8f27d0dc4f6d 100644
--- a/fs/iomap/direct-io.c
+++ b/fs/iomap/direct-io.c
@@ -168,7 +168,9 @@ void iomap_dio_bio_end_io(struct bio *bio)
 			struct task_struct *waiter = dio->submit.waiter;
 			WRITE_ONCE(dio->submit.waiter, NULL);
 			blk_wake_io_task(waiter);
-		} else if (dio->flags & IOMAP_DIO_WRITE) {
+		} else if (dio->flags & IOMAP_DIO_WRITE &&
+			(!dio->iocb->ki_filp->f_inode ||
+			    dio->iocb->ki_filp->f_inode->i_mapping->nrpages))) {
 			struct inode *inode = file_inode(dio->iocb->ki_filp);
 
 			WRITE_ONCE(dio->iocb->private, NULL);
-- 
2.41.0.185.g7c58973941-goog


  reply	other threads:[~2023-06-21 17:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-21 17:29 [PATCH 0/1] iomap regression for aio dio 4k writes Jeremy Bongio
2023-06-21 17:29 ` Jeremy Bongio [this message]
2023-06-21 18:55   ` [PATCH 1/1] For DIO writes with no mapped pages for inode, skip deferring completion Matthew Wilcox
2023-06-22  0:04   ` Dave Chinner
2023-06-21 23:59 ` [PATCH 0/1] iomap regression for aio dio 4k writes Dave Chinner
2023-06-22  1:55   ` Dave Chinner
2023-06-22  2:55     ` Matthew Wilcox
2023-06-22  4:08       ` Christoph Hellwig
2023-06-22  4:47       ` Dave Chinner
2023-06-23  2:32   ` Theodore Ts'o
2023-06-23  3:02     ` Dave Chinner
2023-06-22 23:22 ` Allison Henderson

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=20230621174114.1320834-2-bongiojp@gmail.com \
    --to=bongiojp@gmail.com \
    --cc=allison.henderson@oracle.com \
    --cc=djwong@kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox