summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2020-11-07 13:16:27 +0000
committerJens Axboe <axboe@kernel.dk>2020-12-09 12:04:00 -0700
commit2846c481c9dd1f1fb504b4885bcb815c311df532 (patch)
tree91c04e83e15cdd52314a15d63a2911d25d890d2f /fs
parent632546c4b5a4dad8e3ac456406c65c0db9a0b570 (diff)
downloadlwn-2846c481c9dd1f1fb504b4885bcb815c311df532.tar.gz
lwn-2846c481c9dd1f1fb504b4885bcb815c311df532.zip
io_uring: inline io_import_iovec()
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 <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs')
-rw-r--r--fs/io_uring.c40
1 files changed, 16 insertions, 24 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index b74048b5134a..12a213b147c0 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3150,7 +3150,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)
{
@@ -3196,18 +3196,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;
@@ -3331,7 +3319,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;
@@ -3466,12 +3454,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;
@@ -3592,12 +3582,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;