Skip to content

Commit 4130b49

Browse files
isilenceaxboe
authored andcommitted
io_uring/rsrc: inline io_rsrc_put_work()
io_rsrc_put_work() is simple enough to be open coded into its only caller. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/1b36dd46766ced39a9b160767babfa2fce07b8f8.1681822823.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 26147da commit 4130b49

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

io_uring/rsrc.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ static void io_buffer_unmap(struct io_ring_ctx *ctx, struct io_mapped_ubuf **slo
140140
*slot = NULL;
141141
}
142142

143-
static void io_rsrc_put_work_one(struct io_rsrc_data *rsrc_data,
144-
struct io_rsrc_put *prsrc)
143+
static void io_rsrc_put_work(struct io_rsrc_data *rsrc_data,
144+
struct io_rsrc_put *prsrc)
145145
{
146146
struct io_ring_ctx *ctx = rsrc_data->ctx;
147147

@@ -150,16 +150,6 @@ static void io_rsrc_put_work_one(struct io_rsrc_data *rsrc_data,
150150
rsrc_data->do_put(ctx, prsrc);
151151
}
152152

153-
static void __io_rsrc_put_work(struct io_rsrc_node *ref_node)
154-
{
155-
struct io_rsrc_data *rsrc_data = ref_node->rsrc_data;
156-
157-
if (likely(!ref_node->empty))
158-
io_rsrc_put_work_one(rsrc_data, &ref_node->item);
159-
160-
io_rsrc_node_destroy(rsrc_data->ctx, ref_node);
161-
}
162-
163153
void io_rsrc_node_destroy(struct io_ring_ctx *ctx, struct io_rsrc_node *node)
164154
{
165155
if (!io_alloc_cache_put(&ctx->rsrc_node_cache, &node->cache))
@@ -178,7 +168,10 @@ void io_rsrc_node_ref_zero(struct io_rsrc_node *node)
178168
if (node->refs)
179169
break;
180170
list_del(&node->node);
181-
__io_rsrc_put_work(node);
171+
172+
if (likely(!node->empty))
173+
io_rsrc_put_work(node->rsrc_data, &node->item);
174+
io_rsrc_node_destroy(ctx, node);
182175
}
183176
if (list_empty(&ctx->rsrc_ref_list) && unlikely(ctx->rsrc_quiesce))
184177
wake_up_all(&ctx->rsrc_quiesce_wq);

io_uring/rsrc.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ struct io_mapped_ubuf {
5858

5959
void io_rsrc_put_tw(struct callback_head *cb);
6060
void io_rsrc_node_ref_zero(struct io_rsrc_node *node);
61-
void io_rsrc_put_work(struct work_struct *work);
6261
void io_rsrc_node_destroy(struct io_ring_ctx *ctx, struct io_rsrc_node *ref_node);
6362
struct io_rsrc_node *io_rsrc_node_alloc(struct io_ring_ctx *ctx);
6463
int io_queue_rsrc_removal(struct io_rsrc_data *data, unsigned idx, void *rsrc);

0 commit comments

Comments
 (0)