Skip to content

Commit 6498c5c

Browse files
committed
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: Jens Axboe <axboe@kernel.dk>
1 parent 50220d6 commit 6498c5c

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

io_uring/net.c

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -129,22 +129,19 @@ static void io_netmsg_recycle(struct io_kiocb *req, unsigned int issue_flags)
129129
}
130130
}
131131

132-
static struct io_async_msghdr *io_msg_alloc_async(struct io_kiocb *req,
133-
unsigned int issue_flags)
132+
static struct io_async_msghdr *io_msg_alloc_async(struct io_kiocb *req)
134133
{
135134
struct io_ring_ctx *ctx = req->ctx;
136135
struct io_cache_entry *entry;
137136
struct io_async_msghdr *hdr;
138137

139-
if (!(issue_flags & IO_URING_F_UNLOCKED)) {
140-
entry = io_alloc_cache_get(&ctx->netmsg_cache);
141-
if (entry) {
142-
hdr = container_of(entry, struct io_async_msghdr, cache);
143-
hdr->free_iov = NULL;
144-
req->flags |= REQ_F_ASYNC_DATA;
145-
req->async_data = hdr;
146-
return hdr;
147-
}
138+
entry = io_alloc_cache_get(&ctx->netmsg_cache);
139+
if (entry) {
140+
hdr = container_of(entry, struct io_async_msghdr, cache);
141+
hdr->free_iov = NULL;
142+
req->flags |= REQ_F_ASYNC_DATA;
143+
req->async_data = hdr;
144+
return hdr;
148145
}
149146

150147
if (!io_alloc_async_data(req)) {
@@ -155,12 +152,6 @@ static struct io_async_msghdr *io_msg_alloc_async(struct io_kiocb *req,
155152
return NULL;
156153
}
157154

158-
static inline struct io_async_msghdr *io_msg_alloc_async_prep(struct io_kiocb *req)
159-
{
160-
/* ->prep_async is always called from the submission context */
161-
return io_msg_alloc_async(req, 0);
162-
}
163-
164155
#ifdef CONFIG_COMPAT
165156
static int io_compat_msg_copy_hdr(struct io_kiocb *req,
166157
struct io_async_msghdr *iomsg,
@@ -328,8 +319,7 @@ static int io_sendmsg_prep_setup(struct io_kiocb *req, int is_msg)
328319
struct io_async_msghdr *kmsg;
329320
int ret;
330321

331-
/* always locked for prep */
332-
kmsg = io_msg_alloc_async(req, 0);
322+
kmsg = io_msg_alloc_async(req);
333323
if (unlikely(!kmsg))
334324
return -ENOMEM;
335325
if (!is_msg)
@@ -550,8 +540,7 @@ static int io_recvmsg_prep_setup(struct io_kiocb *req)
550540
struct io_async_msghdr *kmsg;
551541
int ret;
552542

553-
/* always locked for prep */
554-
kmsg = io_msg_alloc_async(req, 0);
543+
kmsg = io_msg_alloc_async(req);
555544
if (unlikely(!kmsg))
556545
return -ENOMEM;
557546

0 commit comments

Comments
 (0)