Skip to content

Commit 34f0bc4

Browse files
isilenceaxboe
authored andcommitted
io_uring: reuse io_alloc_req()
Don't duplicate io_alloc_req() in io_req_caches_free() but reuse the helper. Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/6005fc88274864a49fc3096c22d8bdd605cf8576.1665891182.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent 4d50595 commit 34f0bc4

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

io_uring/io_uring.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2560,18 +2560,14 @@ static int io_eventfd_unregister(struct io_ring_ctx *ctx)
25602560

25612561
static void io_req_caches_free(struct io_ring_ctx *ctx)
25622562
{
2563-
struct io_submit_state *state = &ctx->submit_state;
25642563
int nr = 0;
25652564

25662565
mutex_lock(&ctx->uring_lock);
2567-
io_flush_cached_locked_reqs(ctx, state);
2566+
io_flush_cached_locked_reqs(ctx, &ctx->submit_state);
25682567

25692568
while (!io_req_cache_empty(ctx)) {
2570-
struct io_wq_work_node *node;
2571-
struct io_kiocb *req;
2569+
struct io_kiocb *req = io_alloc_req(ctx);
25722570

2573-
node = wq_stack_extract(&state->free_list);
2574-
req = container_of(node, struct io_kiocb, comp_list);
25752571
kmem_cache_free(req_cachep, req);
25762572
nr++;
25772573
}

0 commit comments

Comments
 (0)