fs: add IOCB flags related to passing back dio completions
authorJens Axboe <axboe@kernel.dk>
Sat, 8 Jul 2023 15:55:27 +0000 (09:55 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 18 Jul 2023 19:39:34 +0000 (13:39 -0600)
commite1c16145b3b75041f9b796c27e1fd43092f229d2
tree9aa92bfa4a97a87a03d684edd49991105c7d689b
parent97c2a1265e5f8d31db03f6ad553b6bb95eecfadd
fs: add IOCB flags related to passing back dio completions

Async dio completions generally happen from hard/soft IRQ context, which
means that users like iomap may need to defer some of the completion
handling to a workqueue. This is less efficient than having the original
issuer handle it, like we do for sync IO, and it adds latency to the
completions.

Add IOCB_DIO_DEFER, which the issuer can set if it is able to safely
punt these completions to a safe context. If the dio handler is aware
of this flag, assign a callback handler in kiocb->dio_complete and
associated data io kiocb->private. The issuer will then call this handler
with that data from task context.

No functional changes in this patch.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/fs.h