Skip to content

Commit

Permalink
io_uring/rsrc: inline io_rsrc_put_work()
Browse files Browse the repository at this point in the history
io_rsrc_put_work() is simple enough to be open coded into its only
caller.

Signed-off-by: Pavel Begunkov <[email protected]>
Link: https://lore.kernel.org/r/1b36dd46766ced39a9b160767babfa2fce07b8f8.1681822823.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
isilence authored and axboe committed Apr 19, 2023
1 parent 26147da commit 4130b49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
19 changes: 6 additions & 13 deletions io_uring/rsrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ static void io_buffer_unmap(struct io_ring_ctx *ctx, struct io_mapped_ubuf **slo
*slot = NULL;
}

static void io_rsrc_put_work_one(struct io_rsrc_data *rsrc_data,
struct io_rsrc_put *prsrc)
static void io_rsrc_put_work(struct io_rsrc_data *rsrc_data,
struct io_rsrc_put *prsrc)
{
struct io_ring_ctx *ctx = rsrc_data->ctx;

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

static void __io_rsrc_put_work(struct io_rsrc_node *ref_node)
{
struct io_rsrc_data *rsrc_data = ref_node->rsrc_data;

if (likely(!ref_node->empty))
io_rsrc_put_work_one(rsrc_data, &ref_node->item);

io_rsrc_node_destroy(rsrc_data->ctx, ref_node);
}

void io_rsrc_node_destroy(struct io_ring_ctx *ctx, struct io_rsrc_node *node)
{
if (!io_alloc_cache_put(&ctx->rsrc_node_cache, &node->cache))
Expand All @@ -178,7 +168,10 @@ void io_rsrc_node_ref_zero(struct io_rsrc_node *node)
if (node->refs)
break;
list_del(&node->node);
__io_rsrc_put_work(node);

if (likely(!node->empty))
io_rsrc_put_work(node->rsrc_data, &node->item);
io_rsrc_node_destroy(ctx, node);
}
if (list_empty(&ctx->rsrc_ref_list) && unlikely(ctx->rsrc_quiesce))
wake_up_all(&ctx->rsrc_quiesce_wq);
Expand Down
1 change: 0 additions & 1 deletion io_uring/rsrc.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ struct io_mapped_ubuf {

void io_rsrc_put_tw(struct callback_head *cb);
void io_rsrc_node_ref_zero(struct io_rsrc_node *node);
void io_rsrc_put_work(struct work_struct *work);
void io_rsrc_node_destroy(struct io_ring_ctx *ctx, struct io_rsrc_node *ref_node);
struct io_rsrc_node *io_rsrc_node_alloc(struct io_ring_ctx *ctx);
int io_queue_rsrc_removal(struct io_rsrc_data *data, unsigned idx, void *rsrc);
Expand Down

0 comments on commit 4130b49

Please sign in to comment.