summaryrefslogtreecommitdiff
path: root/io_uring/rw.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2022-09-02 15:16:29 -0600
committerJens Axboe <axboe@kernel.dk>2022-09-21 10:30:42 -0600
commita1119fb0711591c2aaf99be79d87ce8ebeb9d250 (patch)
tree777ba8c1bd6447c1c3ed0a6cdd9b145df77a0162 /io_uring/rw.c
parent585079b6e425387b5f8ec242fc38081c31ca41ee (diff)
io_uring: cleanly separate request types for iopoll
After the addition of iopoll support for passthrough, there's a bit of a mixup here. Clean it up and get rid of the casting for the passthrough command type. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/rw.c')
-rw-r--r--io_uring/rw.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/io_uring/rw.c b/io_uring/rw.c
index b6f9c756b7a1..9187344ae285 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -1000,7 +1000,7 @@ int io_do_iopoll(struct io_ring_ctx *ctx, bool force_nonspin)
wq_list_for_each(pos, start, &ctx->iopoll_list) {
struct io_kiocb *req = container_of(pos, struct io_kiocb, comp_list);
- struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw);
+ struct file *file = req->file;
int ret;
/*
@@ -1012,12 +1012,15 @@ int io_do_iopoll(struct io_ring_ctx *ctx, bool force_nonspin)
break;
if (req->opcode == IORING_OP_URING_CMD) {
- struct io_uring_cmd *ioucmd = (struct io_uring_cmd *)rw;
+ struct io_uring_cmd *ioucmd;
- ret = req->file->f_op->uring_cmd_iopoll(ioucmd);
- } else
- ret = rw->kiocb.ki_filp->f_op->iopoll(&rw->kiocb, &iob,
- poll_flags);
+ ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd);
+ ret = file->f_op->uring_cmd_iopoll(ioucmd);
+ } else {
+ struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw);
+
+ ret = file->f_op->iopoll(&rw->kiocb, &iob, poll_flags);
+ }
if (unlikely(ret < 0))
return ret;
else if (ret)