public inbox for [email protected]
 help / color / mirror / Atom feed
* __io_file_supports_nowait for regular files
@ 2022-07-21 15:37 Christoph Hellwig
  2022-07-21 15:59 ` Jens Axboe
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2022-07-21 15:37 UTC (permalink / raw)
  To: axboe; +Cc: io-uring

Hi Jens,

is there any good reason __io_file_supports_nowait checks the
blk_queue_nowait flag for regular files?  The FMODE_NOWAIT is set
for regular files that support nowait I/O, and should be all that
is needed.  Even with a block device that does not nonblocking
I/O some thing like reading from the page cache can be done
non-blocking.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: __io_file_supports_nowait for regular files
  2022-07-21 15:37 __io_file_supports_nowait for regular files Christoph Hellwig
@ 2022-07-21 15:59 ` Jens Axboe
  2022-07-21 16:23   ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2022-07-21 15:59 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: io-uring

On 7/21/22 9:37 AM, Christoph Hellwig wrote:
> Hi Jens,
> 
> is there any good reason __io_file_supports_nowait checks the
> blk_queue_nowait flag for regular files?  The FMODE_NOWAIT is set
> for regular files that support nowait I/O, and should be all that
> is needed.  Even with a block device that does not nonblocking
> I/O some thing like reading from the page cache can be done
> non-blocking.

Nope, we can probably kill that check then. Want to send a patch?

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: __io_file_supports_nowait for regular files
  2022-07-21 15:59 ` Jens Axboe
@ 2022-07-21 16:23   ` Christoph Hellwig
  2022-07-21 18:46     ` Jens Axboe
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2022-07-21 16:23 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Christoph Hellwig, io-uring

On Thu, Jul 21, 2022 at 09:59:40AM -0600, Jens Axboe wrote:
> On 7/21/22 9:37 AM, Christoph Hellwig wrote:
> > Hi Jens,
> > 
> > is there any good reason __io_file_supports_nowait checks the
> > blk_queue_nowait flag for regular files?  The FMODE_NOWAIT is set
> > for regular files that support nowait I/O, and should be all that
> > is needed.  Even with a block device that does not nonblocking
> > I/O some thing like reading from the page cache can be done
> > non-blocking.
> 
> Nope, we can probably kill that check then. Want to send a patch?

What would be a good way to verify it doesn't break any strange
assumptions?  I kinda don't fell too comfortable touching io_uring
guts.

> 
> -- 
> Jens Axboe
---end quoted text---

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: __io_file_supports_nowait for regular files
  2022-07-21 16:23   ` Christoph Hellwig
@ 2022-07-21 18:46     ` Jens Axboe
  2022-07-22 15:59       ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2022-07-21 18:46 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: io-uring

On 7/21/22 10:23 AM, Christoph Hellwig wrote:
> On Thu, Jul 21, 2022 at 09:59:40AM -0600, Jens Axboe wrote:
>> On 7/21/22 9:37 AM, Christoph Hellwig wrote:
>>> Hi Jens,
>>>
>>> is there any good reason __io_file_supports_nowait checks the
>>> blk_queue_nowait flag for regular files?  The FMODE_NOWAIT is set
>>> for regular files that support nowait I/O, and should be all that
>>> is needed.  Even with a block device that does not nonblocking
>>> I/O some thing like reading from the page cache can be done
>>> non-blocking.
>>
>> Nope, we can probably kill that check then. Want to send a patch?
> 
> What would be a good way to verify it doesn't break any strange
> assumptions?  I kinda don't fell too comfortable touching io_uring
> guts.

Looking a bit deeper at this, FMODE_NOWAIT is about the file. The nowait
check for the bdev is about whether the driver honors NOWAIT
submissions. Any blk-mq driver will be fine, bio based ones probably
not. You could very well end up blocking off the submit path in that
case.

I'm not convinced we don't still need that check.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: __io_file_supports_nowait for regular files
  2022-07-21 18:46     ` Jens Axboe
@ 2022-07-22 15:59       ` Christoph Hellwig
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2022-07-22 15:59 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Christoph Hellwig, io-uring

On Thu, Jul 21, 2022 at 12:46:16PM -0600, Jens Axboe wrote:
> Looking a bit deeper at this, FMODE_NOWAIT is about the file.

Yes.

> The nowait
> check for the bdev is about whether the driver honors NOWAIT
> submissions. Any blk-mq driver will be fine, bio based ones probably
> not. You could very well end up blocking off the submit path in that
> case.

But do these submissions even matter for the high level interface?
We'd get -EAGAIN way more often without them (or all the time
for direct I/O), but does that strictly matter for the interface?

Note that for mny file systems (at least btrfs, f2fs and xfs) just
checking s_bdev is not enough any way as they can use multiple block
devices.

I'm also a little confused now that I'm looking more into this,
as iomap only uses REQ_NOWAIT for polled direct I/O to start with.
The legacy direct I/O code uses it for all writes as long as
IOCB_NOWAIT is set, so it seems like only the block device code
really makes extensive and most likely correct use of the
REQ_NOWAIT flag anyway.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-07-22 15:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-21 15:37 __io_file_supports_nowait for regular files Christoph Hellwig
2022-07-21 15:59 ` Jens Axboe
2022-07-21 16:23   ` Christoph Hellwig
2022-07-21 18:46     ` Jens Axboe
2022-07-22 15:59       ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox