This proves to be useful functionality for the THP page cache. Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> --- include/linux/xarray.h | 1 + lib/xarray.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/linux/xarray.h b/include/linux/xarray.h index 92c0160b3352..4d40279f49d1 100644 --- a/include/linux/xarray.h +++ b/include/linux/xarray.h @@ -1503,6 +1503,7 @@ void *xas_find_marked(struct xa_state *, unsigned long max, xa_mark_t); void xas_init_marks(const struct xa_state *); bool xas_nomem(struct xa_state *, gfp_t); +void xas_destroy(struct xa_state *); void xas_pause(struct xa_state *); void xas_create_range(struct xa_state *); diff --git a/lib/xarray.c b/lib/xarray.c index fb3a0ccebb7e..fc70e37c4c17 100644 --- a/lib/xarray.c +++ b/lib/xarray.c @@ -258,13 +258,14 @@ static void xa_node_free(struct xa_node *node) call_rcu(&node->rcu_head, radix_tree_node_rcu_free); } -/* +/** * xas_destroy() - Free any resources allocated during the XArray operation. * @xas: XArray operation state. * - * This function is now internal-only. + * Usually xas_destroy() is called by xas_nomem(), but some users want to + * unconditionally release any memory that was allocated. */ -static void xas_destroy(struct xa_state *xas) +void xas_destroy(struct xa_state *xas) { struct xa_node *next, *node = xas->xa_alloc; -- 2.28.0