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/rsrc.h | |
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/rsrc.h')
-rw-r--r-- | io_uring/rsrc.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/io_uring/rsrc.h b/io_uring/rsrc.h index c8a64a9ed5b9..7a4668deaa1a 100644 --- a/io_uring/rsrc.h +++ b/io_uring/rsrc.h @@ -111,6 +111,13 @@ static inline void io_req_assign_rsrc_node(struct io_rsrc_node **dst_node, *dst_node = node; } +static inline void io_req_assign_buf_node(struct io_kiocb *req, + struct io_rsrc_node *node) +{ + io_req_assign_rsrc_node(&req->buf_node, node); + req->flags |= REQ_F_BUF_NODE; +} + int io_files_update(struct io_kiocb *req, unsigned int issue_flags); int io_files_update_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe); |