io_uring: don't delay io_init_req() error check
authorPavel Begunkov <asml.silence@gmail.com>
Sat, 10 Oct 2020 17:34:13 +0000 (18:34 +0100)
committerJens Axboe <axboe@kernel.dk>
Sat, 10 Oct 2020 18:49:25 +0000 (12:49 -0600)
Don't postpone io_init_req() error checks and do that right after
calling it. There is no control-flow statements or dependencies with
sqe/submitted accounting, so do those earlier, that makes the code flow
a bit more natural.

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

index 2e0105c373ae0a284315bb5a79886d8f0bff22ac..22d1fb9cc80f33ed12bccf37bacae141eee759c5 100644 (file)
@@ -6466,12 +6466,11 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr)
                                submitted = -EAGAIN;
                        break;
                }
-
-               err = io_init_req(ctx, req, sqe, &state);
                io_consume_sqe(ctx);
                /* will complete beyond this point, count as submitted */
                submitted++;
 
+               err = io_init_req(ctx, req, sqe, &state);
                if (unlikely(err)) {
 fail_req:
                        io_put_req(req);