diff mbox series

[01/19] XArray: Expose xas_destroy

Message ID 20201029193405.29125-2-willy@infradead.org
State New
Headers show
Series Transparent Hugepages for non-tmpfs filesystems | expand

Commit Message

Matthew Wilcox (Oracle) Oct. 29, 2020, 7:33 p.m. UTC
This proves to be useful functionality for the THP page cache.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/xarray.h | 1 +
 lib/xarray.c           | 7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

Comments

Zi Yan Oct. 29, 2020, 8:33 p.m. UTC | #1
On 29 Oct 2020, at 15:33, Matthew Wilcox (Oracle) wrote:

> This proves to be useful functionality for the THP page cache.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>  include/linux/xarray.h | 1 +
>  lib/xarray.c           | 7 ++++---
>  2 files changed, 5 insertions(+), 3 deletions(-)

LGTM. Reviewed-by: Zi Yan <ziy@nvidia.com>

—
Best Regards,
Yan Zi
diff mbox series

Patch

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;