io_uring/rw: add write support for IOCB_DIO_DEFER
authorJens Axboe <axboe@kernel.dk>
Sat, 8 Jul 2023 16:03:52 +0000 (10:03 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 18 Jul 2023 19:39:34 +0000 (13:39 -0600)
commit0908bd3282b8a7d1572b1a3aef40f6415bccd662
tree08f9fab58ab9d327853eec7f83682297ad3da83f
parente1c16145b3b75041f9b796c27e1fd43092f229d2
io_uring/rw: add write support for IOCB_DIO_DEFER

If the filesystem dio handler understands IOCB_DIO_DEFER, we'll get
a kiocb->ki_complete() callback with kiocb->dio_complete set. In that
case, rather than complete the IO directly through task_work, queue
up an intermediate task_work handler that first processes this
callback and then immediately completes the request.

For XFS, this avoids a punt through a workqueue, which is a lot less
efficient and adds latency to lower queue depth (or sync) O_DIRECT
writes.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/rw.c