OSDN Git Service

io_uring: don't do full *prep_worker() from io-wq
authorPavel Begunkov <asml.silence@gmail.com>
Mon, 24 Feb 2020 08:30:17 +0000 (11:30 +0300)
committerJens Axboe <axboe@kernel.dk>
Mon, 2 Mar 2020 21:04:28 +0000 (14:04 -0700)
io_prep_async_worker() called io_wq_assign_next() do many useless checks:
io_req_work_grab_env() was already called during prep, and @do_hashed
is not ever used. Add io_prep_next_work() -- simplified version, that
can be called io-wq.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c

index 83ae190..6f08521 100644 (file)
@@ -950,6 +950,17 @@ static inline void io_req_work_drop_env(struct io_kiocb *req)
        }
 }
 
+static inline void io_prep_next_work(struct io_kiocb *req,
+                                    struct io_kiocb **link)
+{
+       const struct io_op_def *def = &io_op_defs[req->opcode];
+
+       if (!(req->flags & REQ_F_ISREG) && def->unbound_nonreg_file)
+               req->work.flags |= IO_WQ_WORK_UNBOUND;
+
+       *link = io_prep_linked_timeout(req);
+}
+
 static inline bool io_prep_async_work(struct io_kiocb *req,
                                      struct io_kiocb **link)
 {
@@ -2453,7 +2464,7 @@ static void io_wq_assign_next(struct io_wq_work **workptr, struct io_kiocb *nxt)
 {
        struct io_kiocb *link;
 
-       io_prep_async_work(nxt, &link);
+       io_prep_next_work(nxt, &link);
        *workptr = &nxt->work;
        if (link) {
                nxt->work.flags |= IO_WQ_WORK_CB;