From: Matthew Wilcox <willy@infradead.org>
To: Jeremy Bongio <bongiojp@gmail.com>
Cc: Ted Tso <tytso@mit.edu>, "Darrick J . Wong" <djwong@kernel.org>,
Allison Henderson <allison.henderson@oracle.com>,
linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/1] For DIO writes with no mapped pages for inode, skip deferring completion.
Date: Wed, 21 Jun 2023 19:55:29 +0100 [thread overview]
Message-ID: <ZJNHoWGqkVEVStXz@casper.infradead.org> (raw)
In-Reply-To: <20230621174114.1320834-2-bongiojp@gmail.com>
On Wed, Jun 21, 2023 at 10:29:20AM -0700, Jeremy Bongio wrote:
> +++ 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))) {
I don't think it's possible for file->f_inode to be NULL here, is it?
At any rate, that amount of indirection is just nasty. How about this?
+++ b/fs/iomap/direct-io.c
@@ -161,15 +161,19 @@ 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 {
struct inode *inode = file_inode(dio->iocb->ki_filp);
WRITE_ONCE(dio->iocb->private, NULL);
- INIT_WORK(&dio->aio.work, iomap_dio_complete_work);
- queue_work(inode->i_sb->s_dio_done_wq, &dio->aio.work);
- } else {
- WRITE_ONCE(dio->iocb->private, NULL);
- iomap_dio_complete_work(&dio->aio.work);
+ if (dio->flags & IOMAP_DIO_WRITE &&
+ (inode->i_mapping->nrpages > 0) {
+ INIT_WORK(&dio->aio.work,
+ iomap_dio_complete_work);
+ queue_work(inode->i_sb->s_dio_done_wq,
+ &dio->aio.work);
+ } else {
+ iomap_dio_complete_work(&dio->aio.work);
+ }
}
}
next prev parent reply other threads:[~2023-06-21 18:55 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 ` [PATCH 1/1] For DIO writes with no mapped pages for inode, skip deferring completion Jeremy Bongio
2023-06-21 18:55 ` Matthew Wilcox [this message]
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=ZJNHoWGqkVEVStXz@casper.infradead.org \
--to=willy@infradead.org \
--cc=allison.henderson@oracle.com \
--cc=bongiojp@gmail.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;
as well as URLs for NNTP newsgroup(s).