From: Fengnan Chang <fengnanchang@gmail.com>
To: Christoph Hellwig <hch@lst.de>,
Fengnan Chang <changfengnan@bytedance.com>
Cc: Christian Brauner <brauner@kernel.org>,
"Darrick J . Wong" <djwong@kernel.org>,
linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-ext4@vger.kernel.org, tom.leiming@gmail.com
Subject: Re: [PATCH] iomap: disable I/O polling when direct I/O must wait
Date: Tue, 1 Dec 2026 16:48:35 +0800 [thread overview]
Message-ID: <1c2ff9ad-243e-4ebc-8f3d-aa2d1f21f09d@gmail.com> (raw)
In-Reply-To: <20261201080800.GA26780@lst.de>
在 01/12/26 16:08, Christoph Hellwig 写道:
> On Tue, Dec 01, 2026 at 03:49:22AM +0000, Fengnan Chang wrote:
>> With IOMAP_DIO_FORCE_WAIT, __iomap_dio_rw() waits for the bios of an
>> asynchronous kiocb in the submission path. That wait does not poll, and
>> the caller, such as io_uring, cannot poll before __iomap_dio_rw()
>> returns.
>>
>> Such writes usually do not poll, because a mapping that needs
>> completion work clears IOCB_HIPRI. But IOCB_HIPRI is only cleared once
>> that mapping is reached, and a bio for an earlier mapping may already
>> have been submitted as polled.
>>
>> For example, an ext4 unaligned write that covers a written block
>> followed by an unwritten block needs sub-block zeroing, so ext4 passes
>> IOMAP_DIO_FORCE_WAIT. The bio for the written block is submitted as
>> polled, and the task then waits for it without polling. On a poll
>> queue the write stalls until the request times out; NVMe then reaps
>> the completion from its timeout handler, after 30 seconds by default.
>>
>> Like synchronous kiocbs, do not poll the bios if the caller will wait
>> for them: clear IOCB_HIPRI before submitting any bio.
>>
>> Reproduced with an io_uring IOPOLL write of 4 KiB at offset 2 KiB to
>> such an ext4 file on a null_blk device with poll queues: the write
>> failed with -ETIMEDOUT after the request timeout. With this change it
>> completes and reads back correctly.
>
> Looks good:
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
>
> I've seen you've also posted various other polling fixes. Any chance
> you could try to wire up your tests in blktests or xfstests so that we
> get test coverage for these cases?
Sure, I'll do it later.
prev parent reply other threads:[~2026-12-01 8:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 3:49 [PATCH] iomap: disable I/O polling when direct I/O must wait Fengnan Chang
2026-12-01 4:06 ` sashiko-bot
2026-12-01 8:08 ` Christoph Hellwig
2026-12-01 8:48 ` Fengnan Chang [this message]
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=1c2ff9ad-243e-4ebc-8f3d-aa2d1f21f09d@gmail.com \
--to=fengnanchang@gmail.com \
--cc=brauner@kernel.org \
--cc=changfengnan@bytedance.com \
--cc=djwong@kernel.org \
--cc=hch@lst.de \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=tom.leiming@gmail.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