__io_file_supports_nowait for regular files
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.
Jens Axboe
maintainerQuoted 8 lines · Christoph Hellwig
Hi Jens,
is there any good reason
__io_file_supports_nowaitchecks theblk_queue_nowaitflag for regular files? TheFMODE_NOWAITis 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?
Signature · 1 line
Jens Axboe
Quoted 11 lines · Jens Axboe
Quoted 8 lines · Christoph Hellwig
Hi Jens,
is there any good reason
__io_file_supports_nowaitchecks theblk_queue_nowaitflag for regular files? TheFMODE_NOWAITis 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.
Quoted 3 lines
Signature · 2 lines
-- Jens Axboe
---end quoted text---
Jens Axboe
maintainerQuoted 11 lines · Christoph Hellwig
Quoted 10 lines · Jens Axboe
Quoted 8 lines · Christoph Hellwig
Hi Jens,
is there any good reason
__io_file_supports_nowaitchecks theblk_queue_nowaitflag for regular files? TheFMODE_NOWAITis 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.
Quoted 5 lines
Quoted 1 line
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_uringguts.
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.
Signature · 1 line
Jens Axboe
Quoted 1 line · Jens Axboe
Looking a bit deeper at this,
FMODE_NOWAITis about the file.
Yes.
Quoted 5 lines
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.