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, 11 Jul 2023 19:51:19 +0000 (13:51 -0600)
commitf9f8b03900fcd09aa9906ce72627ba23d818ff8d
treefd3a2dd615c95bc2e3f28a932584aee10750e76d
parentbb0b98891149e2f954c26dfc476bbf8fa9d06525
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