Commit 6498c5c9 authored by Jens Axboe's avatar Jens Axboe

io_uring: kill io_msg_alloc_async_prep()

We now ONLY call io_msg_alloc_async() from inside prep handling, which
is always locked. No need for this helper anymore, or the check in
io_msg_alloc_async() on whether the ring is locked or not.
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 50220d6a
...@@ -129,22 +129,19 @@ static void io_netmsg_recycle(struct io_kiocb *req, unsigned int issue_flags) ...@@ -129,22 +129,19 @@ static void io_netmsg_recycle(struct io_kiocb *req, unsigned int issue_flags)
} }
} }
static struct io_async_msghdr *io_msg_alloc_async(struct io_kiocb *req, static struct io_async_msghdr *io_msg_alloc_async(struct io_kiocb *req)
unsigned int issue_flags)
{ {
struct io_ring_ctx *ctx = req->ctx; struct io_ring_ctx *ctx = req->ctx;
struct io_cache_entry *entry; struct io_cache_entry *entry;
struct io_async_msghdr *hdr; struct io_async_msghdr *hdr;
if (!(issue_flags & IO_URING_F_UNLOCKED)) { entry = io_alloc_cache_get(&ctx->netmsg_cache);
entry = io_alloc_cache_get(&ctx->netmsg_cache); if (entry) {
if (entry) { hdr = container_of(entry, struct io_async_msghdr, cache);
hdr = container_of(entry, struct io_async_msghdr, cache); hdr->free_iov = NULL;
hdr->free_iov = NULL; req->flags |= REQ_F_ASYNC_DATA;
req->flags |= REQ_F_ASYNC_DATA; req->async_data = hdr;
req->async_data = hdr; return hdr;
return hdr;
}
} }
if (!io_alloc_async_data(req)) { if (!io_alloc_async_data(req)) {
...@@ -155,12 +152,6 @@ static struct io_async_msghdr *io_msg_alloc_async(struct io_kiocb *req, ...@@ -155,12 +152,6 @@ static struct io_async_msghdr *io_msg_alloc_async(struct io_kiocb *req,
return NULL; return NULL;
} }
static inline struct io_async_msghdr *io_msg_alloc_async_prep(struct io_kiocb *req)
{
/* ->prep_async is always called from the submission context */
return io_msg_alloc_async(req, 0);
}
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
static int io_compat_msg_copy_hdr(struct io_kiocb *req, static int io_compat_msg_copy_hdr(struct io_kiocb *req,
struct io_async_msghdr *iomsg, struct io_async_msghdr *iomsg,
...@@ -328,8 +319,7 @@ static int io_sendmsg_prep_setup(struct io_kiocb *req, int is_msg) ...@@ -328,8 +319,7 @@ static int io_sendmsg_prep_setup(struct io_kiocb *req, int is_msg)
struct io_async_msghdr *kmsg; struct io_async_msghdr *kmsg;
int ret; int ret;
/* always locked for prep */ kmsg = io_msg_alloc_async(req);
kmsg = io_msg_alloc_async(req, 0);
if (unlikely(!kmsg)) if (unlikely(!kmsg))
return -ENOMEM; return -ENOMEM;
if (!is_msg) if (!is_msg)
...@@ -550,8 +540,7 @@ static int io_recvmsg_prep_setup(struct io_kiocb *req) ...@@ -550,8 +540,7 @@ static int io_recvmsg_prep_setup(struct io_kiocb *req)
struct io_async_msghdr *kmsg; struct io_async_msghdr *kmsg;
int ret; int ret;
/* always locked for prep */ kmsg = io_msg_alloc_async(req);
kmsg = io_msg_alloc_async(req, 0);
if (unlikely(!kmsg)) if (unlikely(!kmsg))
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment