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>
Fri, 21 Jul 2023 14:06:13 +0000 (08:06 -0600)
commitfc146276a4675dc4ca17af3a021077a84058c1da
treeecd7551f7bb6c228dcf84a6871760a8b7970f534
parent5e84d76ac6dc99385729ef38cb0da6db3028b3be
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.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/fs.h