Skip to content

Commit

Permalink
io_uring/rsrc: refactor io_queue_rsrc_removal
Browse files Browse the repository at this point in the history
We can queue up a rsrc into a list in io_queue_rsrc_removal() while
allocating io_rsrc_put and so simplify the function.

Signed-off-by: Pavel Begunkov <[email protected]>
Link: https://lore.kernel.org/r/36bd708ee25c0e2e7992dc19b17db166eea9ac40.1681395792.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
isilence authored and axboe committed Apr 15, 2023
1 parent c87fd58 commit c899a5d
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions io_uring/rsrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,6 @@ int io_queue_rsrc_removal(struct io_rsrc_data *data, unsigned idx,
{
u64 *tag_slot = io_get_tag_slot(data, idx);
struct io_rsrc_put *prsrc;
bool inline_item = true;

if (!node->inline_items) {
prsrc = &node->item;
Expand All @@ -694,14 +693,12 @@ int io_queue_rsrc_removal(struct io_rsrc_data *data, unsigned idx,
prsrc = kzalloc(sizeof(*prsrc), GFP_KERNEL);
if (!prsrc)
return -ENOMEM;
inline_item = false;
list_add(&prsrc->list, &node->item_list);
}

prsrc->tag = *tag_slot;
*tag_slot = 0;
prsrc->rsrc = rsrc;
if (!inline_item)
list_add(&prsrc->list, &node->item_list);
return 0;
}

Expand Down

0 comments on commit c899a5d

Please sign in to comment.