Skip to content

Commit 5027d02

Browse files
isilenceaxboe
authored andcommitted
io_uring: unify STOP_MULTISHOT with IOU_OK
IOU_OK means that the request ownership is now handed back to core io_uring and it has to complete it using the result provided in req->cqe. Same is true for multishot and IOU_STOP_MULTISHOT. Rename it into IOU_COMPLETE to avoid confusion and use for both modes. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/e6a5b2edb0eb9558acb1c8f1db38ac45fee95491.1741453534.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 7a9dcb0 commit 5027d02

5 files changed

Lines changed: 9 additions & 28 deletions

File tree

io_uring/io_uring.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1792,7 +1792,6 @@ int io_poll_issue(struct io_kiocb *req, io_tw_token_t tw)
17921792
ret = __io_issue_sqe(req, issue_flags, &io_issue_defs[req->opcode]);
17931793

17941794
WARN_ON_ONCE(ret == IOU_ISSUE_SKIP_COMPLETE);
1795-
WARN_ON_ONCE(ret == IOU_OK);
17961795
return ret;
17971796
}
17981797

io_uring/io_uring.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
#endif
2020

2121
enum {
22-
IOU_OK = 0,
22+
IOU_OK = 0, /* deprecated, use IOU_COMPLETE */
23+
IOU_COMPLETE = 0,
24+
2325
IOU_ISSUE_SKIP_COMPLETE = -EIOCBQUEUED,
2426

2527
/*
@@ -36,13 +38,6 @@ enum {
3638
* valid error code, yet less than -MAX_ERRNO and valid internally.
3739
*/
3840
IOU_REQUEUE = -3072,
39-
40-
/*
41-
* Intended only when both IO_URING_F_MULTISHOT is passed
42-
* to indicate to the poll runner that multishot should be
43-
* removed and the result is set on req->cqe.res.
44-
*/
45-
IOU_STOP_MULTISHOT = -ECANCELED,
4641
};
4742

4843
struct io_wait_queue {

io_uring/net.c

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -915,11 +915,7 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret,
915915
/* Finish the request / stop multishot. */
916916
finish:
917917
io_req_set_res(req, *ret, cflags);
918-
919-
if (issue_flags & IO_URING_F_MULTISHOT)
920-
*ret = IOU_STOP_MULTISHOT;
921-
else
922-
*ret = IOU_OK;
918+
*ret = IOU_COMPLETE;
923919
io_req_msg_cleanup(req, issue_flags);
924920
return true;
925921
}
@@ -1288,9 +1284,7 @@ int io_recvzc(struct io_kiocb *req, unsigned int issue_flags)
12881284
if (len && zc->len == 0) {
12891285
io_req_set_res(req, 0, 0);
12901286

1291-
if (issue_flags & IO_URING_F_MULTISHOT)
1292-
return IOU_STOP_MULTISHOT;
1293-
return IOU_OK;
1287+
return IOU_COMPLETE;
12941288
}
12951289
if (unlikely(ret <= 0) && ret != -EAGAIN) {
12961290
if (ret == -ERESTARTSYS)
@@ -1300,10 +1294,7 @@ int io_recvzc(struct io_kiocb *req, unsigned int issue_flags)
13001294

13011295
req_set_fail(req);
13021296
io_req_set_res(req, ret, 0);
1303-
1304-
if (issue_flags & IO_URING_F_MULTISHOT)
1305-
return IOU_STOP_MULTISHOT;
1306-
return IOU_OK;
1297+
return IOU_COMPLETE;
13071298
}
13081299
return IOU_RETRY;
13091300
}
@@ -1709,9 +1700,7 @@ int io_accept(struct io_kiocb *req, unsigned int issue_flags)
17091700
io_req_set_res(req, ret, cflags);
17101701
if (ret < 0)
17111702
req_set_fail(req);
1712-
if (!(issue_flags & IO_URING_F_MULTISHOT))
1713-
return IOU_OK;
1714-
return IOU_STOP_MULTISHOT;
1703+
return IOU_COMPLETE;
17151704
}
17161705

17171706
int io_socket_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)

io_uring/poll.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ static int io_poll_check_events(struct io_kiocb *req, io_tw_token_t tw)
290290
} else {
291291
int ret = io_poll_issue(req, tw);
292292

293-
if (ret == IOU_STOP_MULTISHOT)
293+
if (ret == IOU_COMPLETE)
294294
return IOU_POLL_REMOVE_POLL_USE_RES;
295295
else if (ret == IOU_REQUEUE)
296296
return IOU_POLL_REQUEUE;

io_uring/rw.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,9 +1104,7 @@ int io_read_mshot(struct io_kiocb *req, unsigned int issue_flags)
11041104
*/
11051105
io_req_set_res(req, ret, cflags);
11061106
io_req_rw_cleanup(req, issue_flags);
1107-
if (issue_flags & IO_URING_F_MULTISHOT)
1108-
return IOU_STOP_MULTISHOT;
1109-
return IOU_OK;
1107+
return IOU_COMPLETE;
11101108
}
11111109

11121110
static bool io_kiocb_start_write(struct io_kiocb *req, struct kiocb *kiocb)

0 commit comments

Comments
 (0)