Skip to content

Commit a1119fb

Browse files
committed
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 <[email protected]>
1 parent 585079b commit a1119fb

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

io_uring/rw.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ int io_do_iopoll(struct io_ring_ctx *ctx, bool force_nonspin)
10001000

10011001
wq_list_for_each(pos, start, &ctx->iopoll_list) {
10021002
struct io_kiocb *req = container_of(pos, struct io_kiocb, comp_list);
1003-
struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw);
1003+
struct file *file = req->file;
10041004
int ret;
10051005

10061006
/*
@@ -1012,12 +1012,15 @@ int io_do_iopoll(struct io_ring_ctx *ctx, bool force_nonspin)
10121012
break;
10131013

10141014
if (req->opcode == IORING_OP_URING_CMD) {
1015-
struct io_uring_cmd *ioucmd = (struct io_uring_cmd *)rw;
1015+
struct io_uring_cmd *ioucmd;
10161016

1017-
ret = req->file->f_op->uring_cmd_iopoll(ioucmd);
1018-
} else
1019-
ret = rw->kiocb.ki_filp->f_op->iopoll(&rw->kiocb, &iob,
1020-
poll_flags);
1017+
ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd);
1018+
ret = file->f_op->uring_cmd_iopoll(ioucmd);
1019+
} else {
1020+
struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw);
1021+
1022+
ret = file->f_op->iopoll(&rw->kiocb, &iob, poll_flags);
1023+
}
10211024
if (unlikely(ret < 0))
10221025
return ret;
10231026
else if (ret)

0 commit comments

Comments
 (0)