Revert "io_uring/rw: disable IOCB_DIO_CALLER_COMP" inode-dio-wait
authorJens Axboe <axboe@kernel.dk>
Tue, 24 Oct 2023 20:44:21 +0000 (14:44 -0600)
committerJens Axboe <axboe@kernel.dk>
Fri, 10 Nov 2023 19:46:24 +0000 (12:46 -0700)
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 <axboe@kernel.dk>
io_uring/rw.c

index 64390d4e20c1875f92d944ad4fddd6c3ad8a140e..ed321ac2e157462b7e5eaff3591229561197c0ad 100644 (file)
@@ -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)