From: Jens Axboe <axboe@kernel.dk>
To: io-uring@vger.kernel.org
Cc: asml.silence@gmail.com, Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 1/3] io_uring/rw: split io_read() into a helper
Date: Mon, 11 Sep 2023 14:40:19 -0600 [thread overview]
Message-ID: <20230911204021.1479172-2-axboe@kernel.dk> (raw)
In-Reply-To: <20230911204021.1479172-1-axboe@kernel.dk>
Add __io_read() which does the grunt of the work, leaving the completion
side to the new io_read(). No functional changes in this patch.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
io_uring/rw.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/io_uring/rw.c b/io_uring/rw.c
index c8c822fa7980..402e8bf002d6 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -708,7 +708,7 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode)
return 0;
}
-int io_read(struct io_kiocb *req, unsigned int issue_flags)
+static int __io_read(struct io_kiocb *req, unsigned int issue_flags)
{
struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw);
struct io_rw_state __s, *s = &__s;
@@ -853,6 +853,17 @@ int io_read(struct io_kiocb *req, unsigned int issue_flags)
/* it's faster to check here then delegate to kfree */
if (iovec)
kfree(iovec);
+ return ret;
+}
+
+int io_read(struct io_kiocb *req, unsigned int issue_flags)
+{
+ int ret;
+
+ ret = __io_read(req, issue_flags);
+ if (unlikely(ret < 0))
+ return ret;
+
return kiocb_done(req, ret, issue_flags);
}
--
2.40.1
next prev parent reply other threads:[~2023-09-11 22:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-11 20:40 [PATCHSET 0/3] Add support for multishot reads Jens Axboe
2023-09-11 20:40 ` Jens Axboe [this message]
2023-09-11 20:40 ` [PATCH 2/3] io_uring/rw: mark readv/writev as vectored in the opcode definition Jens Axboe
2023-09-11 20:40 ` [PATCH 3/3] io_uring/rw: add support for IORING_OP_READ_MULTISHOT Jens Axboe
2023-09-11 23:57 ` Gabriel Krisman Bertazi
2023-09-12 0:46 ` Jens Axboe
2023-09-12 0:53 ` Jens Axboe
2023-09-12 0:38 ` Gabriel Krisman Bertazi
2023-09-12 0:47 ` Jens Axboe
-- strict thread matches above, loose matches on Subject: below --
2023-09-12 17:24 [PATCHSET v2 0/3] Add support for multishot reads Jens Axboe
2023-09-12 17:24 ` [PATCH 1/3] io_uring/rw: split io_read() into a helper Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230911204021.1479172-2-axboe@kernel.dk \
--to=axboe@kernel.dk \
--cc=asml.silence@gmail.com \
--cc=io-uring@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.