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: Add generic helper to allocate async data

This helper replaces io_alloc_async_data by using the folded allocation.
Do it in a header to allow the compiler to decide whether to inline.

Signed-off-by: Gabriel Krisman Bertazi <krisman@suse.de>
Link: https://lore.kernel.org/r/20241216204615.759089-3-krisman@suse.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Gabriel Krisman Bertazi and committed by
Jens Axboe
49f7a309 479b2f45

+11
+11
io_uring/io_uring.h
··· 8 8 #include <linux/poll.h> 9 9 #include <linux/io_uring_types.h> 10 10 #include <uapi/linux/eventpoll.h> 11 + #include "alloc_cache.h" 11 12 #include "io-wq.h" 12 13 #include "slist.h" 13 14 #include "filetable.h" ··· 221 220 { 222 221 req->cqe.res = res; 223 222 req->cqe.flags = cflags; 223 + } 224 + 225 + static inline void *io_uring_alloc_async_data(struct io_alloc_cache *cache, 226 + struct io_kiocb *req, 227 + void (*init_once)(void *obj)) 228 + { 229 + req->async_data = io_cache_alloc(cache, GFP_KERNEL, init_once); 230 + if (req->async_data) 231 + req->flags |= REQ_F_ASYNC_DATA; 232 + return req->async_data; 224 233 } 225 234 226 235 static inline bool req_has_async_data(struct io_kiocb *req)