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, 1 Aug 2023 23:32:43 +0000 (17:32 -0600)
commit9cf3516c29e6dba95d36d7d86c03b06495107859
tree80d8f5a6898ecf8d0b532ab8eaabd3e322e796bc
parent7b3c14d1a96bf63c078c3bbfe5573fb964e80b95
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_CALLER_COMP, 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: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/fs.h