Skip to content

Commit 4614de7

Browse files
isilenceaxboe
authored andcommitted
io_uring/rw: clean up mshot forced sync mode
Move code forcing synchronous execution of multishot read requests out a more generic __io_read(). Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/4ad7b928c776d1ad59addb9fff64ef2d1fc474d5.1739919038.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 74f3e87 commit 4614de7

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

io_uring/rw.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -889,15 +889,7 @@ static int __io_read(struct io_kiocb *req, unsigned int issue_flags)
889889
if (unlikely(ret))
890890
return ret;
891891

892-
if (unlikely(req->opcode == IORING_OP_READ_MULTISHOT)) {
893-
void *cb_copy = rw->kiocb.ki_complete;
894-
895-
rw->kiocb.ki_complete = NULL;
896-
ret = io_iter_do_read(rw, &io->iter);
897-
rw->kiocb.ki_complete = cb_copy;
898-
} else {
899-
ret = io_iter_do_read(rw, &io->iter);
900-
}
892+
ret = io_iter_do_read(rw, &io->iter);
901893

902894
/*
903895
* Some file systems like to return -EOPNOTSUPP for an IOCB_NOWAIT
@@ -995,6 +987,8 @@ int io_read_mshot(struct io_kiocb *req, unsigned int issue_flags)
995987
if (!io_file_can_poll(req))
996988
return -EBADFD;
997989

990+
/* make it sync, multishot doesn't support async execution */
991+
rw->kiocb.ki_complete = NULL;
998992
ret = __io_read(req, issue_flags);
999993

1000994
/*

0 commit comments

Comments
 (0)