From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected], [email protected]
Subject: [PATCH 3/5] io_uring: opcode independent import_fixed
Date: Sun, 15 Nov 2020 10:35:42 +0000 [thread overview]
Message-ID: <ca7010375770aef88dda800021e79db1e6729585.1605435507.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>
Pass a buf explicitly into io_import_fixed(), so it can be used not only
for rw requests.
Signed-off-by: Pavel Begunkov <[email protected]>
---
fs/io_uring.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 88daf5fc7e8e..7703291617f3 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2933,21 +2933,18 @@ static void kiocb_done(struct kiocb *kiocb, ssize_t ret,
io_rw_done(kiocb, ret);
}
-static ssize_t io_import_fixed(struct io_kiocb *req, int rw,
- struct iov_iter *iter)
+static ssize_t io_import_fixed(struct io_kiocb *req, int rw, u64 buf_addr,
+ size_t len, struct iov_iter *iter)
{
struct io_ring_ctx *ctx = req->ctx;
- size_t len = req->rw.len;
struct io_mapped_ubuf *imu;
u16 index, buf_index = req->buf_index;
size_t offset;
- u64 buf_addr;
if (unlikely(buf_index >= ctx->nr_user_bufs))
return -EFAULT;
index = array_index_nospec(buf_index, ctx->nr_user_bufs);
imu = &ctx->user_bufs[index];
- buf_addr = req->rw.addr;
/* overflow */
if (buf_addr + len < buf_addr)
@@ -3153,7 +3150,7 @@ static ssize_t io_import_iovec(int rw, struct io_kiocb *req,
opcode = req->opcode;
if (opcode == IORING_OP_READ_FIXED || opcode == IORING_OP_WRITE_FIXED) {
*iovec = NULL;
- return io_import_fixed(req, rw, iter);
+ return io_import_fixed(req, rw, req->rw.addr, sqe_len, iter);
}
/* buffer index only valid with fixed read/write, or buffer select */
--
2.24.0
next prev parent reply other threads:[~2020-11-15 10:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-15 10:35 [RFC 0/5] support for {send,recv}[msg] with registered bufs Pavel Begunkov
2020-11-15 10:35 ` [PATCH 1/5] io_uring: move io_recvmsg_copy_hdr() Pavel Begunkov
2020-11-15 10:35 ` [PATCH 2/5] io_uring: copy hdr consistently for send and recv Pavel Begunkov
2020-11-15 10:35 ` Pavel Begunkov [this message]
2020-11-15 10:35 ` [PATCH 4/5] io_uring: send/recv with registered buffer Pavel Begunkov
2020-11-15 10:35 ` [PATCH 5/5] io_uring: sendmsg/recvmsg with registered buffers Pavel Begunkov
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=ca7010375770aef88dda800021e79db1e6729585.1605435507.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