Skip to content

Commit 5182ed2

Browse files
isilenceaxboe
authored andcommitted
io_uring: refactor io_submit_flush_completions
Don't init req_batch before we actually need it. Also, add a small clean up for req declaration. Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/ad85512e12bd3a20d521e9782750300970e5afc8.1624739600.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent 4cfb25b commit 5182ed2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

fs/io_uring.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,22 +2132,22 @@ static void io_submit_flush_completions(struct io_ring_ctx *ctx)
21322132
{
21332133
struct io_comp_state *cs = &ctx->submit_state.comp;
21342134
int i, nr = cs->nr;
2135-
struct io_kiocb *req;
21362135
struct req_batch rb;
21372136

2138-
io_init_req_batch(&rb);
21392137
spin_lock_irq(&ctx->completion_lock);
21402138
for (i = 0; i < nr; i++) {
2141-
req = cs->reqs[i];
2139+
struct io_kiocb *req = cs->reqs[i];
2140+
21422141
__io_cqring_fill_event(ctx, req->user_data, req->result,
21432142
req->compl.cflags);
21442143
}
21452144
io_commit_cqring(ctx);
21462145
spin_unlock_irq(&ctx->completion_lock);
2147-
21482146
io_cqring_ev_posted(ctx);
2147+
2148+
io_init_req_batch(&rb);
21492149
for (i = 0; i < nr; i++) {
2150-
req = cs->reqs[i];
2150+
struct io_kiocb *req = cs->reqs[i];
21512151

21522152
/* submission and completion refs */
21532153
if (req_ref_sub_and_test(req, 2))

0 commit comments

Comments
 (0)