mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
io_uring/rsrc: add io_reset_rsrc_node() helper
Puts and reset an existing node in a slot, if one exists. Returns true if a node was there, false if not. This helps cleanup some of the code that does a lookup just to clear an existing node. Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
@@ -84,6 +84,17 @@ static inline void io_put_rsrc_node(struct io_rsrc_node *node)
|
||||
io_free_rsrc_node(node);
|
||||
}
|
||||
|
||||
static inline bool io_reset_rsrc_node(struct io_rsrc_data *data, int index)
|
||||
{
|
||||
struct io_rsrc_node *node = data->nodes[index];
|
||||
|
||||
if (!node)
|
||||
return false;
|
||||
io_put_rsrc_node(node);
|
||||
data->nodes[index] = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void io_req_put_rsrc_nodes(struct io_kiocb *req)
|
||||
{
|
||||
if (req->rsrc_nodes[IORING_RSRC_FILE] != rsrc_empty_node) {
|
||||
|
||||
Reference in New Issue
Block a user