mirror of
https://github.com/torvalds/linux.git
synced 2024-12-27 13:22:23 +00:00
io_uring/net: dedup io_recv_finish req completion
There are two block in io_recv_finish() completing the request, which we can combine and remove jumping. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/0e338dcb33c88de83809fda021cba9e7c9681620.1709905727.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
e0e4ab52d1
commit
1af04699c5
@ -694,20 +694,12 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret,
|
|||||||
if (msg->msg_inq > 0)
|
if (msg->msg_inq > 0)
|
||||||
cflags |= IORING_CQE_F_SOCK_NONEMPTY;
|
cflags |= IORING_CQE_F_SOCK_NONEMPTY;
|
||||||
|
|
||||||
if (!(req->flags & REQ_F_APOLL_MULTISHOT)) {
|
|
||||||
io_req_set_res(req, *ret, cflags);
|
|
||||||
*ret = IOU_OK;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mshot_finished)
|
|
||||||
goto finish;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fill CQE for this receive and see if we should keep trying to
|
* Fill CQE for this receive and see if we should keep trying to
|
||||||
* receive from this socket.
|
* receive from this socket.
|
||||||
*/
|
*/
|
||||||
if (io_fill_cqe_req_aux(req, issue_flags & IO_URING_F_COMPLETE_DEFER,
|
if ((req->flags & REQ_F_APOLL_MULTISHOT) && !mshot_finished &&
|
||||||
|
io_fill_cqe_req_aux(req, issue_flags & IO_URING_F_COMPLETE_DEFER,
|
||||||
*ret, cflags | IORING_CQE_F_MORE)) {
|
*ret, cflags | IORING_CQE_F_MORE)) {
|
||||||
struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg);
|
struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg);
|
||||||
int mshot_retry_ret = IOU_ISSUE_SKIP_COMPLETE;
|
int mshot_retry_ret = IOU_ISSUE_SKIP_COMPLETE;
|
||||||
@ -727,8 +719,8 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret,
|
|||||||
*ret = -EAGAIN;
|
*ret = -EAGAIN;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/* Otherwise stop multishot but use the current result. */
|
|
||||||
finish:
|
/* Finish the request / stop multishot. */
|
||||||
io_req_set_res(req, *ret, cflags);
|
io_req_set_res(req, *ret, cflags);
|
||||||
|
|
||||||
if (issue_flags & IO_URING_F_MULTISHOT)
|
if (issue_flags & IO_URING_F_MULTISHOT)
|
||||||
|
Loading…
Reference in New Issue
Block a user