Skip to content

Commit 91e5d76

Browse files
committed
io_uring/net: un-indent mshot retry path in io_recv_finish()
In preparation for putting some retry logic in there, have the done path just skip straight to the end rather than have too much nesting in here. No functional changes in this patch. Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent e84b01a commit 91e5d76

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

io_uring/net.c

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -645,23 +645,27 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret,
645645
return true;
646646
}
647647

648-
if (!mshot_finished) {
649-
if (io_fill_cqe_req_aux(req, issue_flags & IO_URING_F_COMPLETE_DEFER,
650-
*ret, cflags | IORING_CQE_F_MORE)) {
651-
io_recv_prep_retry(req);
652-
/* Known not-empty or unknown state, retry */
653-
if (cflags & IORING_CQE_F_SOCK_NONEMPTY ||
654-
msg->msg_inq == -1)
655-
return false;
656-
if (issue_flags & IO_URING_F_MULTISHOT)
657-
*ret = IOU_ISSUE_SKIP_COMPLETE;
658-
else
659-
*ret = -EAGAIN;
660-
return true;
661-
}
662-
/* Otherwise stop multishot but use the current result. */
663-
}
648+
if (mshot_finished)
649+
goto finish;
664650

651+
/*
652+
* Fill CQE for this receive and see if we should keep trying to
653+
* receive from this socket.
654+
*/
655+
if (io_fill_cqe_req_aux(req, issue_flags & IO_URING_F_COMPLETE_DEFER,
656+
*ret, cflags | IORING_CQE_F_MORE)) {
657+
io_recv_prep_retry(req);
658+
/* Known not-empty or unknown state, retry */
659+
if (cflags & IORING_CQE_F_SOCK_NONEMPTY || msg->msg_inq == -1)
660+
return false;
661+
if (issue_flags & IO_URING_F_MULTISHOT)
662+
*ret = IOU_ISSUE_SKIP_COMPLETE;
663+
else
664+
*ret = -EAGAIN;
665+
return true;
666+
}
667+
/* Otherwise stop multishot but use the current result. */
668+
finish:
665669
io_req_set_res(req, *ret, cflags);
666670

667671
if (issue_flags & IO_URING_F_MULTISHOT)

0 commit comments

Comments
 (0)