From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>,
[email protected], David Laight <[email protected]>
Subject: [PATCH 3/3] io_uring: inline io_import_iovec()
Date: Sat, 7 Nov 2020 13:16:27 +0000 [thread overview]
Message-ID: <684967bb875a968eac626607b729b33c2512bba1.1604754823.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>
Inline io_import_iovec() and leave only its former __io_import_iovec()
renamed to the original name. That makes it more obious what is reused in
io_read/write().
Signed-off-by: Pavel Begunkov <[email protected]>
---
fs/io_uring.c | 40 ++++++++++++++++------------------------
1 file changed, 16 insertions(+), 24 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index f3033e3929c1..2e435b336927 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3135,7 +3135,7 @@ static ssize_t io_iov_buffer_select(struct io_kiocb *req, struct iovec *iov,
return __io_iov_buffer_select(req, iov, needs_lock);
}
-static ssize_t __io_import_iovec(int rw, struct io_kiocb *req,
+static ssize_t io_import_iovec(int rw, struct io_kiocb *req,
struct iovec **iovec, struct iov_iter *iter,
bool needs_lock)
{
@@ -3181,18 +3181,6 @@ static ssize_t __io_import_iovec(int rw, struct io_kiocb *req,
req->ctx->compat);
}
-static ssize_t io_import_iovec(int rw, struct io_kiocb *req,
- struct iovec **iovec, struct iov_iter *iter,
- bool needs_lock)
-{
- struct io_async_rw *iorw = req->async_data;
-
- if (!iorw)
- return __io_import_iovec(rw, req, iovec, iter, needs_lock);
- *iovec = NULL;
- return 0;
-}
-
static inline loff_t *io_kiocb_ppos(struct kiocb *kiocb)
{
return (kiocb->ki_filp->f_mode & FMODE_STREAM) ? NULL : &kiocb->ki_pos;
@@ -3316,7 +3304,7 @@ static inline int io_rw_prep_async(struct io_kiocb *req, int rw)
struct iovec *iov = iorw->fast_iov;
ssize_t ret;
- ret = __io_import_iovec(rw, req, &iov, &iorw->iter, false);
+ ret = io_import_iovec(rw, req, &iov, &iorw->iter, false);
if (unlikely(ret < 0))
return ret;
@@ -3451,12 +3439,14 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
ssize_t io_size, ret, ret2;
bool no_async;
- if (rw)
+ if (rw) {
iter = &rw->iter;
-
- ret = io_import_iovec(READ, req, &iovec, iter, !force_nonblock);
- if (ret < 0)
- return ret;
+ iovec = NULL;
+ } else {
+ ret = io_import_iovec(READ, req, &iovec, iter, !force_nonblock);
+ if (ret < 0)
+ return ret;
+ }
io_size = iov_iter_count(iter);
req->result = io_size;
ret = 0;
@@ -3577,12 +3567,14 @@ static int io_write(struct io_kiocb *req, bool force_nonblock,
struct io_async_rw *rw = req->async_data;
ssize_t ret, ret2, io_size;
- if (rw)
+ if (rw) {
iter = &rw->iter;
-
- ret = io_import_iovec(WRITE, req, &iovec, iter, !force_nonblock);
- if (ret < 0)
- return ret;
+ iovec = NULL;
+ } else {
+ ret = io_import_iovec(WRITE, req, &iovec, iter, !force_nonblock);
+ if (ret < 0)
+ return ret;
+ }
io_size = iov_iter_count(iter);
req->result = io_size;
--
2.24.0
next prev parent reply other threads:[~2020-11-07 13:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-07 13:16 [PATCH 5.11 0/3] rw import_iovec cleanups Pavel Begunkov
2020-11-07 13:16 ` [PATCH 1/3] fs/io_uring Don't use the return value from import_iovec() Pavel Begunkov
2020-11-07 13:16 ` [PATCH 2/3] io_uring: remove duplicated io_size from rw Pavel Begunkov
2020-11-07 13:16 ` Pavel Begunkov [this message]
2020-11-09 14:42 ` [PATCH 5.11 0/3] rw import_iovec cleanups 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=684967bb875a968eac626607b729b33c2512bba1.1604754823.git.asml.silence@gmail.com \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox