diff options
| author | Jens Axboe <axboe@kernel.dk> | 2025-01-23 07:34:36 -0700 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2025-01-23 11:32:34 -0700 |
| commit | ff74954e4e9374f24b95dd46ef0bb1b5fa0a46f2 (patch) | |
| tree | e58116d2af4d7fccfeb23910c8565218063dbfb7 /io_uring/io_uring.h | |
| parent | fa3595523d72d13508befd28cf2ca642cafc69f7 (diff) | |
io_uring/alloc_cache: get rid of _nocache() helper
Just allow passing in NULL for the cache, if the type in question
doesn't have a cache associated with it.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/io_uring.h')
| -rw-r--r-- | io_uring/io_uring.h | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h index 67adbb3c1bf5..ab619e63ef39 100644 --- a/io_uring/io_uring.h +++ b/io_uring/io_uring.h @@ -228,18 +228,14 @@ static inline void io_req_set_res(struct io_kiocb *req, s32 res, u32 cflags) static inline void *io_uring_alloc_async_data(struct io_alloc_cache *cache, struct io_kiocb *req) { - req->async_data = io_cache_alloc(cache, GFP_KERNEL); - if (req->async_data) - req->flags |= REQ_F_ASYNC_DATA; - return req->async_data; -} + if (cache) { + req->async_data = io_cache_alloc(cache, GFP_KERNEL); + } else { + const struct io_issue_def *def = &io_issue_defs[req->opcode]; -static inline void *io_uring_alloc_async_data_nocache(struct io_kiocb *req) -{ - const struct io_issue_def *def = &io_issue_defs[req->opcode]; - - WARN_ON_ONCE(!def->async_size); - req->async_data = kmalloc(def->async_size, GFP_KERNEL); + WARN_ON_ONCE(!def->async_size); + req->async_data = kmalloc(def->async_size, GFP_KERNEL); + } if (req->async_data) req->flags |= REQ_F_ASYNC_DATA; return req->async_data; |
