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;
if (WARN_ON_ONCE(req_has_async_data(req)))
return -EFAULT;
- data = io_uring_alloc_async_data_nocache(req);
+ data = io_uring_alloc_async_data(NULL, req);
if (!data)
return -ENOMEM;
data->req = req;
struct io_waitid_async *iwa;
int ret;
- iwa = io_uring_alloc_async_data_nocache(req);
+ iwa = io_uring_alloc_async_data(NULL, req);
if (!iwa)
return -ENOMEM;