Skip to content

Commit c899a5d

Browse files
isilenceaxboe
authored andcommitted
io_uring/rsrc: refactor io_queue_rsrc_removal
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]>
1 parent c87fd58 commit c899a5d

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

io_uring/rsrc.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,6 @@ int io_queue_rsrc_removal(struct io_rsrc_data *data, unsigned idx,
685685
{
686686
u64 *tag_slot = io_get_tag_slot(data, idx);
687687
struct io_rsrc_put *prsrc;
688-
bool inline_item = true;
689688

690689
if (!node->inline_items) {
691690
prsrc = &node->item;
@@ -694,14 +693,12 @@ int io_queue_rsrc_removal(struct io_rsrc_data *data, unsigned idx,
694693
prsrc = kzalloc(sizeof(*prsrc), GFP_KERNEL);
695694
if (!prsrc)
696695
return -ENOMEM;
697-
inline_item = false;
696+
list_add(&prsrc->list, &node->item_list);
698697
}
699698

700699
prsrc->tag = *tag_slot;
701700
*tag_slot = 0;
702701
prsrc->rsrc = rsrc;
703-
if (!inline_item)
704-
list_add(&prsrc->list, &node->item_list);
705702
return 0;
706703
}
707704

0 commit comments

Comments
 (0)