Skip to contentSkip to conversation

io_uring/rw: clean up __io_read() obsolete comment and early returns

PATCH Applied Joanne Koong 2 participants 2 messages Apr 1 io_uring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_uring/rw: clean up __io_read() obsolete comment and early returns

After commit a9165b83c193 ("io_uring/rw: always setup io_async_rw for read/write requests") which moved the iovec allocation into the prep path and stores it in req->async_data where it now gets freed as part of the request lifecycle, this comment is now outdated.

Remove it and clean up the goto as well.

---
 io_uring/rw.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
io_uring/rw.c +5 -6
index 046f76a71b9c..20654deff84d 100644
@@ -962,13 +962,13 @@ static int __io_read(struct io_kiocb *req, struct io_br_sel *sel,
 	if (ret == -EAGAIN) {
 		/* If we can poll, just do that. */
 		if (io_file_can_poll(req))
-			return -EAGAIN;
+			return ret;
 		/* IOPOLL retry should happen for io-wq threads */
 		if (!force_nonblock && !(req->flags & REQ_F_IOPOLL))
-			goto done;
+			return ret;
 		/* no retry on NONBLOCK nor RWF_NOWAIT */
 		if (req->flags & REQ_F_NOWAIT)
-			goto done;
+			return ret;
 		ret = 0;
 	} else if (ret == -EIOCBQUEUED) {
 		return IOU_ISSUE_SKIP_COMPLETE;
@@ -976,7 +976,7 @@ static int __io_read(struct io_kiocb *req, struct io_br_sel *sel,
 		   (req->flags & REQ_F_NOWAIT) || !need_complete_io(req) ||
 		   (issue_flags & IO_URING_F_MULTISHOT)) {
 		/* read all, failed, already did sync or don't want to retry */
-		goto done;
+		return ret;
 	}
 
 	/*
@@ -1019,8 +1019,7 @@ static int __io_read(struct io_kiocb *req, struct io_br_sel *sel,
 		kiocb->ki_flags &= ~IOCB_WAITQ;
 		iov_iter_restore(&io->iter, &io->iter_state);
 	} while (ret > 0);
-done:
-	/* it's faster to check here than delegate to kfree */
+
 	return ret;
 }
 
Signature · 1 line
2.52.0
maintainer Applied
#1 lore raw
Quoted 8 lines · Joanne Koong

After commit a9165b83c193 ("io_uring/rw: always setup io_async_rw for read/write requests") which moved the iovec allocation into the prep path and stores it in req->async_data where it now gets freed as part of the request lifecycle, this comment is now outdated.

Remove it and clean up the goto as well.

[...]

Applied, thanks!

[1/1] io_uring/rw: clean up __io_read() obsolete comment and early returns

      commit: c3196f84b1e4089287bfc6745496213f1e46bc00

Best regards,

Signature · 1 line
Jens Axboe