This abstract away the cache details. Signed-off-by: Gabriel Krisman Bertazi <krisman@xxxxxxx> --- io_uring/rw.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/io_uring/rw.c b/io_uring/rw.c index b62cdb5fc936..7f1890f23312 100644 --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -213,28 +213,16 @@ static int io_rw_alloc_async(struct io_kiocb *req) struct io_ring_ctx *ctx = req->ctx; struct io_async_rw *rw; - rw = io_alloc_cache_get(&ctx->rw_cache); - if (rw) { - if (rw->free_iovec) { - kasan_mempool_unpoison_object(rw->free_iovec, - rw->free_iov_nr * sizeof(struct iovec)); - req->flags |= REQ_F_NEED_CLEANUP; - } - req->flags |= REQ_F_ASYNC_DATA; - req->async_data = rw; - goto done; - } - - if (!io_alloc_async_data(req)) { - rw = req->async_data; - rw->free_iovec = NULL; - rw->free_iov_nr = 0; -done: + rw = io_uring_alloc_async_data(&ctx->rw_cache, req); + if (!rw) + return -ENOMEM; + if (rw->free_iovec) { + kasan_mempool_unpoison_object(rw->free_iovec, + rw->free_iov_nr * sizeof(struct iovec)); + req->flags |= REQ_F_NEED_CLEANUP; rw->bytes_done = 0; - return 0; } - - return -ENOMEM; + return 0; } static int io_prep_rw_setup(struct io_kiocb *req, int ddir, bool do_import) -- 2.47.0