diff options
| author | Pavel Begunkov <asml.silence@gmail.com> | 2025-02-24 13:31:10 -0800 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2025-02-27 07:17:39 -0700 |
| commit | 5d309914773370308eb98d1db664eb18f502c5a6 (patch) | |
| tree | a018a10d40b56dd0015a4db8957d25d42c683d11 /io_uring/rw.c | |
| parent | 69d483d5f43e7a525246090c80f978b827104ad4 (diff) | |
| download | lwn-5d309914773370308eb98d1db664eb18f502c5a6.tar.gz lwn-5d309914773370308eb98d1db664eb18f502c5a6.zip | |
io_uring: combine buffer lookup and import
Registered buffer are currently imported in two steps, first we lookup
a rsrc node and then use it to set up the iterator. The first part is
usually done at the prep stage, and import happens whenever it's needed.
As we want to defer binding to a node so that it works with linked
requests, combine both steps into a single helper.
Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20250224213116.3509093-6-kbusch@meta.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/rw.c')
| -rw-r--r-- | io_uring/rw.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/io_uring/rw.c b/io_uring/rw.c index 10a4a95ada02..ae44d7e5d200 100644 --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -342,8 +342,6 @@ static int io_prep_rw_fixed(struct io_kiocb *req, const struct io_uring_sqe *sqe int ddir) { struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw); - struct io_ring_ctx *ctx = req->ctx; - struct io_rsrc_node *node; struct io_async_rw *io; int ret; @@ -351,13 +349,8 @@ static int io_prep_rw_fixed(struct io_kiocb *req, const struct io_uring_sqe *sqe if (unlikely(ret)) return ret; - node = io_rsrc_node_lookup(&ctx->buf_table, req->buf_index); - if (!node) - return -EFAULT; - io_req_assign_buf_node(req, node); - io = req->async_data; - ret = io_import_fixed(ddir, &io->iter, node->buf, rw->addr, rw->len); + ret = io_import_reg_buf(req, &io->iter, rw->addr, rw->len, ddir, 0); iov_iter_save_state(&io->iter, &io->iter_state); return ret; } |
