diff options
author | Ming Lei <ming.lei@redhat.com> | 2024-11-07 19:01:36 +0800 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-11-07 15:24:33 -0700 |
commit | 039c878db7add23c1c9ea18424c442cce76670f9 (patch) | |
tree | 5815f2cce4e7e3667058e68a6f624a39731a4eb3 /io_uring/rw.c | |
parent | 4f219fcce5e4366cc121fc98270beb1fbbb3df2b (diff) |
io_uring/rsrc: add & apply io_req_assign_buf_node()
The following pattern becomes more and more:
+ io_req_assign_rsrc_node(&req->buf_node, node);
+ req->flags |= REQ_F_BUF_NODE;
so make it a helper, which is less fragile to use than above code, for
example, the BUF_NODE flag is even missed in current io_uring_cmd_prep().
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20241107110149.890530-4-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/rw.c')
-rw-r--r-- | io_uring/rw.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/io_uring/rw.c b/io_uring/rw.c index e368b9afde03..b62cdb5fc936 100644 --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -341,8 +341,7 @@ static int io_prep_rw_fixed(struct io_kiocb *req, const struct io_uring_sqe *sqe node = io_rsrc_node_lookup(&ctx->buf_table, req->buf_index); if (!node) return -EFAULT; - io_req_assign_rsrc_node(&req->buf_node, node); - req->flags |= REQ_F_BUF_NODE; + io_req_assign_buf_node(req, node); io = req->async_data; ret = io_import_fixed(ddir, &io->iter, node->buf, rw->addr, rw->len); |