public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Christoph Hellwig <[email protected]>
Cc: Christian Brauner <[email protected]>,
	[email protected], Dave Chinner <[email protected]>,
	[email protected], "Darrick J . Wong" <[email protected]>,
	[email protected], wu lei <[email protected]>
Subject: Re: [PATCH v2 1/1] iomap: propagate nowait to block layer
Date: Tue, 4 Mar 2025 16:41:40 +0000	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 3/4/25 16:07, Christoph Hellwig wrote:
> On Tue, Mar 04, 2025 at 12:18:07PM +0000, Pavel Begunkov wrote:
>>   	    ((dio->flags & IOMAP_DIO_NEED_SYNC) && !use_fua) ||
>> -	    ((dio->flags & IOMAP_DIO_WRITE) && pos >= i_size_read(inode)))
>> +	    ((dio->flags & IOMAP_DIO_WRITE) && pos >= i_size_read(inode))) {
>>   		dio->flags &= ~IOMAP_DIO_CALLER_COMP;
>>   
>> +		if (!is_sync_kiocb(dio->iocb) &&
>> +		    (dio->iocb->ki_flags & IOCB_NOWAIT))
>> +			return -EAGAIN;
> 
> Black magic without comments explaining it.

I can copy the comment from below if you wish.

>> +	if (!is_sync_kiocb(dio->iocb) && (dio->iocb->ki_flags & IOCB_NOWAIT)) {
>> +		/*
>> +		 * This is nonblocking IO, and we might need to allocate
>> +		 * multiple bios. In this case, as we cannot guarantee that
>> +		 * one of the sub bios will not fail getting issued FOR NOWAIT
>> +		 * and as error results are coalesced across all of them, ask
>> +		 * for a retry of this from blocking context.
>> +		 */
>> +		if (bio_iov_vecs_to_alloc(dio->submit.iter, BIO_MAX_VECS + 1) >
>> +					  BIO_MAX_VECS)
> 
> This is not very accurate in times of multi-page bvecs and large order
> folios all over.

bio_iov_vecs_to_alloc() can overestimate, i.e. the check might return
-EAGAIN in more cases than required but not the other way around,
that should be enough for a fix such as this patch. Or did I maybe
misunderstood you?

> I think you really need to byte the bullet and support for early returns
> from the non-blocking bio submission path.

Assuming you're suggesting to implement that, I can't say I'm excited by
the idea of reworking a non trivial chunk of block layer to fix a problem
and then porting it up to some 5.x, especially since it was already
attempted before by someone and ultimately got reverted.

-- 
Pavel Begunkov


  reply	other threads:[~2025-03-04 16:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-04 12:18 [PATCH v2 1/1] iomap: propagate nowait to block layer Pavel Begunkov
2025-03-04 16:07 ` Christoph Hellwig
2025-03-04 16:41   ` Pavel Begunkov [this message]
2025-03-04 16:59     ` Christoph Hellwig
2025-03-04 17:36       ` Jens Axboe
2025-03-04 23:26         ` Christoph Hellwig
2025-03-04 23:43           ` Jens Axboe
2025-03-04 23:49             ` Christoph Hellwig
2025-03-05  0:14               ` Pavel Begunkov
2025-03-05  0:18                 ` Pavel Begunkov
2025-03-04 17:54       ` Pavel Begunkov
2025-03-04 23:28         ` Christoph Hellwig
2025-03-04 19:22     ` Darrick J. Wong
2025-03-04 20:35       ` Pavel Begunkov
2025-03-05  0:01         ` Christoph Hellwig
2025-03-05  0:45           ` Pavel Begunkov
2025-03-05  1:34             ` Christoph Hellwig
2025-03-04 21:11 ` Dave Chinner
2025-03-04 22:47   ` Pavel Begunkov
2025-03-04 23:40     ` Christoph Hellwig
2025-03-05  1:19     ` Dave Chinner
2025-03-05 14:10       ` Christoph Hellwig

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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