Skip to content

Commit ff74954

Browse files
committed
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 <[email protected]>
1 parent fa35955 commit ff74954

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

io_uring/io_uring.h

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -228,18 +228,14 @@ static inline void io_req_set_res(struct io_kiocb *req, s32 res, u32 cflags)
228228
static inline void *io_uring_alloc_async_data(struct io_alloc_cache *cache,
229229
struct io_kiocb *req)
230230
{
231-
req->async_data = io_cache_alloc(cache, GFP_KERNEL);
232-
if (req->async_data)
233-
req->flags |= REQ_F_ASYNC_DATA;
234-
return req->async_data;
235-
}
231+
if (cache) {
232+
req->async_data = io_cache_alloc(cache, GFP_KERNEL);
233+
} else {
234+
const struct io_issue_def *def = &io_issue_defs[req->opcode];
236235

237-
static inline void *io_uring_alloc_async_data_nocache(struct io_kiocb *req)
238-
{
239-
const struct io_issue_def *def = &io_issue_defs[req->opcode];
240-
241-
WARN_ON_ONCE(!def->async_size);
242-
req->async_data = kmalloc(def->async_size, GFP_KERNEL);
236+
WARN_ON_ONCE(!def->async_size);
237+
req->async_data = kmalloc(def->async_size, GFP_KERNEL);
238+
}
243239
if (req->async_data)
244240
req->flags |= REQ_F_ASYNC_DATA;
245241
return req->async_data;

io_uring/timeout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ static int __io_timeout_prep(struct io_kiocb *req,
544544

545545
if (WARN_ON_ONCE(req_has_async_data(req)))
546546
return -EFAULT;
547-
data = io_uring_alloc_async_data_nocache(req);
547+
data = io_uring_alloc_async_data(NULL, req);
548548
if (!data)
549549
return -ENOMEM;
550550
data->req = req;

io_uring/waitid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ int io_waitid(struct io_kiocb *req, unsigned int issue_flags)
303303
struct io_waitid_async *iwa;
304304
int ret;
305305

306-
iwa = io_uring_alloc_async_data_nocache(req);
306+
iwa = io_uring_alloc_async_data(NULL, req);
307307
if (!iwa)
308308
return -ENOMEM;
309309

0 commit comments

Comments
 (0)