[PATCH 2/4] io_uring: refactor io_req_map_rw()

Pavel Begunkov
2020-09-05T21:48:30Z

Set rw->free_iovec to @iovec, that's gives identical result and stresses
that @iovec param rw->free_iovec play the same role.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
fs/io_uring.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index e45572fbb152..03808e865dde 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2925,7 +2925,7 @@ static void io_req_map_rw(struct io_kiocb *req, const struct iovec *iovec,
struct io_async_rw *rw = &req->io->rw;

memcpy(&rw->iter, iter, sizeof(*iter));
- rw->free_iovec = NULL;
+ rw->free_iovec = iovec;
rw->bytes_done = 0;
/* can only be fixed buffers, no need to do anything */
if (iter->type == ITER_BVEC)
@@ -2942,7 +2942,6 @@ static void io_req_map_rw(struct io_kiocb *req, const struct iovec *iovec,
memcpy(rw->fast_iov + iov_off, fast_iov + iov_off,
sizeof(struct iovec) * iter->nr_segs);
} else {
- rw->free_iovec = iovec;
req->flags |= REQ_F_NEED_CLEANUP;
}
}
--
2.24.0