Skip to content

Commit 1af0469

Browse files
isilenceaxboe
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/0e338dcb33c88de83809fda021cba9e7c9681620.1709905727.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent e0e4ab5 commit 1af0469

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

io_uring/net.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -694,20 +694,12 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret,
694694
if (msg->msg_inq > 0)
695695
cflags |= IORING_CQE_F_SOCK_NONEMPTY;
696696

697-
if (!(req->flags & REQ_F_APOLL_MULTISHOT)) {
698-
io_req_set_res(req, *ret, cflags);
699-
*ret = IOU_OK;
700-
return true;
701-
}
702-
703-
if (mshot_finished)
704-
goto finish;
705-
706697
/*
707698
* Fill CQE for this receive and see if we should keep trying to
708699
* receive from this socket.
709700
*/
710-
if (io_fill_cqe_req_aux(req, issue_flags & IO_URING_F_COMPLETE_DEFER,
701+
if ((req->flags & REQ_F_APOLL_MULTISHOT) && !mshot_finished &&
702+
io_fill_cqe_req_aux(req, issue_flags & IO_URING_F_COMPLETE_DEFER,
711703
*ret, cflags | IORING_CQE_F_MORE)) {
712704
struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg);
713705
int mshot_retry_ret = IOU_ISSUE_SKIP_COMPLETE;
@@ -727,8 +719,8 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret,
727719
*ret = -EAGAIN;
728720
return true;
729721
}
730-
/* Otherwise stop multishot but use the current result. */
731-
finish:
722+
723+
/* Finish the request / stop multishot. */
732724
io_req_set_res(req, *ret, cflags);
733725

734726
if (issue_flags & IO_URING_F_MULTISHOT)

0 commit comments

Comments
 (0)