io_uring: allow buffer recycling in READV
PATCH 1/1 io_uring: allow buffer recycling in READV
In commit 934447a603b2 ("io_uring: do not recycle buffer in READV") a temporary fix was put in io_kbuf_recycle to simply never recycle READV buffers.
Instead of that, rather treat READV with REQ_F_BUFFER_SELECTED the same as a READ with REQ_F_BUFFER_SELECTED. Since READV requires iov_len of 1 they are essentially the same.
In order to do this inside io_prep_rw() add some validation to check that it is in fact only length 1, and also extract the length of the buffer at prep time.
This allows removal of the io_iov_buffer_select codepaths as they are only used from the READV op.
Signed-off-by Dylan Yudaken <[email protected]>
--- io_uring/kbuf.h | 8 --- io_uring/rw.c | 134 +++++++++++++++++++----------------------------- 2 files changed, 52 insertions(+), 90 deletions(-)
io_uring/kbuf.h +0 -8
@@ -86,14 +86,6 @@ static inline bool io_do_buffer_select(struct io_kiocb *req)static inline void io_kbuf_recycle (struct io_kiocb *req,unsigned issue_flags) { -/* -* READV uses fields in `struct io_rw` (len/addr) to stash the selected -* buffer data. However if that buffer is recycled the original request -* data stored in addr is lost. Therefore forbid recycling for now. -*/ -if (req->opcode ==IORING_OP_READV ) -return ; -if (req->flags &REQ_F_BUFFER_SELECTED )io_kbuf_recycle_legacy (req, issue_flags);if (req->flags &REQ_F_BUFFER_RING )
io_uring/rw.c +52 -82
164 lines not on this page · raw message
base-commit: a73c11acbf98767f8fb464e463198bc75992ef28
Signature · 1 line
2.30.2