From: Pavel Begunkov Date: Sat, 10 Oct 2020 17:34:13 +0000 (+0100) Subject: io_uring: don't delay io_init_req() error check X-Git-Tag: baikal/mips/sdk5.9~12522^2~3 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=89cd10926338965ab97ba99b25bc6004dbb2d432;p=kernel.git io_uring: don't delay io_init_req() error check 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 Signed-off-by: Jens Axboe --- diff --git a/fs/io_uring.c b/fs/io_uring.c index 2e0105c373ae0..22d1fb9cc80f3 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -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);