Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring/rsrc: remove node assignment helpers

There are two helpers here, one assigns and increments the node ref
count, and the other is simply a wrapper around that for the buffer node
handling.

The buffer node assignment benefits from checking and setting
REQ_F_BUF_NODE together, otherwise stalls have been observed on setting
that flag later in the process. Hence re-do it so that it's set when
checked, and cleared in case of (unlikely) failure. With that, the
buffer node helper can go, and then drop the generic
io_req_assign_rsrc_node() helper as well as there's only a single user
of it left at that point.

Signed-off-by: Jens Axboe <axboe@kernel.dk>

+11 -18
+2 -1
io_uring/io_uring.c
··· 1912 1912 io_ring_submit_lock(ctx, issue_flags); 1913 1913 node = io_rsrc_node_lookup(&ctx->file_table.data, fd); 1914 1914 if (node) { 1915 - io_req_assign_rsrc_node(&req->file_node, node); 1915 + node->refs++; 1916 + req->file_node = node; 1916 1917 req->flags |= io_slot_flags(node); 1917 1918 file = io_slot_file(node); 1918 1919 }
+9 -3
io_uring/rsrc.c
··· 1110 1110 1111 1111 if (req->flags & REQ_F_BUF_NODE) 1112 1112 return req->buf_node; 1113 + req->flags |= REQ_F_BUF_NODE; 1113 1114 1114 1115 io_ring_submit_lock(ctx, issue_flags); 1115 1116 node = io_rsrc_node_lookup(&ctx->buf_table, req->buf_index); 1116 - if (node) 1117 - io_req_assign_buf_node(req, node); 1117 + if (node) { 1118 + node->refs++; 1119 + req->buf_node = node; 1120 + io_ring_submit_unlock(ctx, issue_flags); 1121 + return node; 1122 + } 1123 + req->flags &= ~REQ_F_BUF_NODE; 1118 1124 io_ring_submit_unlock(ctx, issue_flags); 1119 - return node; 1125 + return NULL; 1120 1126 } 1121 1127 1122 1128 int io_import_reg_buf(struct io_kiocb *req, struct iov_iter *iter,
-14
io_uring/rsrc.h
··· 127 127 } 128 128 } 129 129 130 - static inline void io_req_assign_rsrc_node(struct io_rsrc_node **dst_node, 131 - struct io_rsrc_node *node) 132 - { 133 - node->refs++; 134 - *dst_node = node; 135 - } 136 - 137 - static inline void io_req_assign_buf_node(struct io_kiocb *req, 138 - struct io_rsrc_node *node) 139 - { 140 - io_req_assign_rsrc_node(&req->buf_node, node); 141 - req->flags |= REQ_F_BUF_NODE; 142 - } 143 - 144 130 int io_files_update(struct io_kiocb *req, unsigned int issue_flags); 145 131 int io_files_update_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe); 146 132