diff mbox series

[1/4] io_uring: cleanly separate request types for iopoll

Message ID 20220903165234.210547-2-axboe@kernel.dk (mailing list archive)
State New
Headers show
Series Fixups/improvements for iopoll passthrough | expand

Commit Message

Jens Axboe Sept. 3, 2022, 4:52 p.m. UTC
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>
---
 io_uring/rw.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Comments

Kanchan Joshi Sept. 4, 2022, 3:44 p.m. UTC | #1
On Sat, Sep 03, 2022 at 10:52:31AM -0600, Jens Axboe wrote:
>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.

Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
diff mbox series

Patch

diff --git a/io_uring/rw.c b/io_uring/rw.c
index 9698a789b3d5..966c923bc0be 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -994,7 +994,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;
 
 		/*
@@ -1006,12 +1006,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)