Message ID | 20250224213116.3509093-4-kbusch@meta.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | ublk zero copy support | expand |
On Mon, Feb 24, 2025 at 01:31:08PM -0800, Keith Busch wrote: > From: Pavel Begunkov <asml.silence@gmail.com> > > There is already a field in io_kiocb that can store a registered buffer > index, use that instead of stashing the value into struct io_sr_msg. > > Reviewed-by: Keith Busch <kbusch@kernel.org> > Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Reviewed-by: Ming Lei <ming.lei@redhat.com> Thanks, Ming
On 2/24/25 21:31, Keith Busch wrote: > From: Pavel Begunkov <asml.silence@gmail.com> > > There is already a field in io_kiocb that can store a registered buffer > index, use that instead of stashing the value into struct io_sr_msg. Reviewed-by: Pavel Begunkov <asml.silence@gmail.com> > > Reviewed-by: Keith Busch <kbusch@kernel.org> > Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> > --- > io_uring/net.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/io_uring/net.c b/io_uring/net.c > index 173546415ed17..fa35a6b58d472 100644 > --- a/io_uring/net.c > +++ b/io_uring/net.c > @@ -76,7 +76,6 @@ struct io_sr_msg { > u16 flags; > /* initialised and used only by !msg send variants */ > u16 buf_group; > - u16 buf_index; > bool retry; > void __user *msg_control; > /* used only for send zerocopy */ > @@ -1371,7 +1370,7 @@ int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) > > zc->len = READ_ONCE(sqe->len); > zc->msg_flags = READ_ONCE(sqe->msg_flags) | MSG_NOSIGNAL | MSG_ZEROCOPY; > - zc->buf_index = READ_ONCE(sqe->buf_index); > + req->buf_index = READ_ONCE(sqe->buf_index); > if (zc->msg_flags & MSG_DONTWAIT) > req->flags |= REQ_F_NOWAIT; > > @@ -1447,7 +1446,7 @@ static int io_send_zc_import(struct io_kiocb *req, unsigned int issue_flags) > > ret = -EFAULT; > io_ring_submit_lock(ctx, issue_flags); > - node = io_rsrc_node_lookup(&ctx->buf_table, sr->buf_index); > + node = io_rsrc_node_lookup(&ctx->buf_table, req->buf_index); > if (node) { > io_req_assign_buf_node(sr->notif, node); > ret = 0;
diff --git a/io_uring/net.c b/io_uring/net.c index 173546415ed17..fa35a6b58d472 100644 --- a/io_uring/net.c +++ b/io_uring/net.c @@ -76,7 +76,6 @@ struct io_sr_msg { u16 flags; /* initialised and used only by !msg send variants */ u16 buf_group; - u16 buf_index; bool retry; void __user *msg_control; /* used only for send zerocopy */ @@ -1371,7 +1370,7 @@ int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) zc->len = READ_ONCE(sqe->len); zc->msg_flags = READ_ONCE(sqe->msg_flags) | MSG_NOSIGNAL | MSG_ZEROCOPY; - zc->buf_index = READ_ONCE(sqe->buf_index); + req->buf_index = READ_ONCE(sqe->buf_index); if (zc->msg_flags & MSG_DONTWAIT) req->flags |= REQ_F_NOWAIT; @@ -1447,7 +1446,7 @@ static int io_send_zc_import(struct io_kiocb *req, unsigned int issue_flags) ret = -EFAULT; io_ring_submit_lock(ctx, issue_flags); - node = io_rsrc_node_lookup(&ctx->buf_table, sr->buf_index); + node = io_rsrc_node_lookup(&ctx->buf_table, req->buf_index); if (node) { io_req_assign_buf_node(sr->notif, node); ret = 0;