summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Busch <kbusch@kernel.org>2025-02-24 13:31:07 -0800
committerJens Axboe <axboe@kernel.dk>2025-02-27 07:17:39 -0700
commita14ca7a413ec8a9f9184c543691f890a011ed98a (patch)
tree9995870c5cc085c995ae80a804f4d000ab96ad9f
parentc5b47d5a8c0d3c657751f803295213284f432672 (diff)
io_uring/nop: reuse req->buf_index
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_nop. Signed-off-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Pavel Begunkov <asml.silence@gmail.com> Reviewed-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20250224213116.3509093-3-kbusch@meta.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--io_uring/nop.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/io_uring/nop.c b/io_uring/nop.c
index 5e5196df650a..ea539531cb5f 100644
--- a/io_uring/nop.c
+++ b/io_uring/nop.c
@@ -16,7 +16,6 @@ struct io_nop {
struct file *file;
int result;
int fd;
- int buffer;
unsigned int flags;
};
@@ -40,9 +39,7 @@ int io_nop_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
else
nop->fd = -1;
if (nop->flags & IORING_NOP_FIXED_BUFFER)
- nop->buffer = READ_ONCE(sqe->buf_index);
- else
- nop->buffer = -1;
+ req->buf_index = READ_ONCE(sqe->buf_index);
return 0;
}
@@ -69,7 +66,7 @@ int io_nop(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, nop->buffer);
+ node = io_rsrc_node_lookup(&ctx->buf_table, req->buf_index);
if (node) {
io_req_assign_buf_node(req, node);
ret = 0;