From: Jens Axboe Date: Tue, 24 Oct 2023 20:44:21 +0000 (-0600) Subject: Revert "io_uring/rw: disable IOCB_DIO_CALLER_COMP" X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=refs%2Fheads%2Finode-dio-wait;p=linux-2.6-block.git Revert "io_uring/rw: disable IOCB_DIO_CALLER_COMP" This reverts commit 9f4e9d79e89bd7ffc1dfbe7901f2b1f19d73c1d4. Now that inode_dio_wait() with deferred task_work is properly handled, we can re-introduce this optimization. Signed-off-by: Jens Axboe --- diff --git a/io_uring/rw.c b/io_uring/rw.c index 64390d4e20c1..ed321ac2e157 100644 --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -1025,6 +1025,15 @@ int io_write(struct io_kiocb *req, unsigned int issue_flags) kiocb_start_write(kiocb); kiocb->ki_flags |= IOCB_WRITE; + /* + * For non-polled IO, set IOCB_DIO_CALLER_COMP, stating that our handler + * groks deferring the completion to task context. This isn't + * necessary and useful for polled IO as that can always complete + * directly. + */ + if (!(kiocb->ki_flags & IOCB_HIPRI)) + kiocb->ki_flags |= IOCB_DIO_CALLER_COMP; + if (likely(req->file->f_op->write_iter)) ret2 = call_write_iter(req->file, kiocb, &s->iter); else if (req->file->f_op->write)