Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <krisman@suse.de>
Link: https://lore.kernel.org/r/20241216204615.759089-6-krisman@suse.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Gabriel Krisman Bertazi and committed by
Jens Axboe
e9447dc0 12108729

+2 -18
+2 -18
io_uring/uring_cmd.c
··· 16 16 #include "rsrc.h" 17 17 #include "uring_cmd.h" 18 18 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 - 35 19 static void io_req_uring_cleanup(struct io_kiocb *req, unsigned int issue_flags) 36 20 { 37 21 struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd); ··· 169 185 struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd); 170 186 struct uring_cache *cache; 171 187 172 - cache = io_uring_async_get(req); 173 - if (unlikely(!cache)) 188 + cache = io_uring_alloc_async_data(&req->ctx->uring_cache, req, NULL); 189 + if (!cache) 174 190 return -ENOMEM; 175 191 176 192 if (!(req->flags & REQ_F_FORCE_ASYNC)) {