mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
XArray: Add private interface for workingset node deletion
Move the tricky bits of dealing with the XArray from the workingset code to the XArray. Make it clear in the documentation that this is a private interface, and only export it for the benefit of the test suite. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
This commit is contained in:
23
lib/xarray.c
23
lib/xarray.c
@@ -1973,6 +1973,29 @@ unsigned int xa_extract(struct xarray *xa, void **dst, unsigned long start,
|
||||
}
|
||||
EXPORT_SYMBOL(xa_extract);
|
||||
|
||||
/**
|
||||
* xa_delete_node() - Private interface for workingset code.
|
||||
* @node: Node to be removed from the tree.
|
||||
* @update: Function to call to update ancestor nodes.
|
||||
*
|
||||
* Context: xa_lock must be held on entry and will not be released.
|
||||
*/
|
||||
void xa_delete_node(struct xa_node *node, xa_update_node_t update)
|
||||
{
|
||||
struct xa_state xas = {
|
||||
.xa = node->array,
|
||||
.xa_index = (unsigned long)node->offset <<
|
||||
(node->shift + XA_CHUNK_SHIFT),
|
||||
.xa_shift = node->shift + XA_CHUNK_SHIFT,
|
||||
.xa_offset = node->offset,
|
||||
.xa_node = xa_parent_locked(node->array, node),
|
||||
.xa_update = update,
|
||||
};
|
||||
|
||||
xas_store(&xas, NULL);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(xa_delete_node); /* For the benefit of the test suite */
|
||||
|
||||
/**
|
||||
* xa_destroy() - Free all internal data structures.
|
||||
* @xa: XArray.
|
||||
|
Reference in New Issue
Block a user