Skip to content

Commit e9447dc

Browse files
krismanaxboe
authored andcommitted
io_uring/uring_cmd: Allocate async data through generic helper
This abstracts away the cache details and simplify the code. Signed-off-by: Gabriel Krisman Bertazi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 1210872 commit e9447dc

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

io_uring/uring_cmd.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,6 @@
1616
#include "rsrc.h"
1717
#include "uring_cmd.h"
1818

19-
static struct uring_cache *io_uring_async_get(struct io_kiocb *req)
20-
{
21-
struct io_ring_ctx *ctx = req->ctx;
22-
struct uring_cache *cache;
23-
24-
cache = io_alloc_cache_get(&ctx->uring_cache);
25-
if (cache) {
26-
req->flags |= REQ_F_ASYNC_DATA;
27-
req->async_data = cache;
28-
return cache;
29-
}
30-
if (!io_alloc_async_data(req))
31-
return req->async_data;
32-
return NULL;
33-
}
34-
3519
static void io_req_uring_cleanup(struct io_kiocb *req, unsigned int issue_flags)
3620
{
3721
struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd);
@@ -185,8 +169,8 @@ static int io_uring_cmd_prep_setup(struct io_kiocb *req,
185169
struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd);
186170
struct uring_cache *cache;
187171

188-
cache = io_uring_async_get(req);
189-
if (unlikely(!cache))
172+
cache = io_uring_alloc_async_data(&req->ctx->uring_cache, req, NULL);
173+
if (!cache)
190174
return -ENOMEM;
191175

192176
if (!(req->flags & REQ_F_FORCE_ASYNC)) {

0 commit comments

Comments
 (0)