aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/radix-tree/xarray.c
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@infradead.org>2017-11-07 14:57:46 -0500
committerMatthew Wilcox <willy@infradead.org>2018-10-21 10:45:57 -0400
commitad3d6c7263e368abdc151e1cc13dc78aa39cc7a7 (patch)
tree54279b42ac6fbede3abc75ea44fbe1554b633228 /tools/testing/radix-tree/xarray.c
parentxarray: Add documentation (diff)
downloadlinux-dev-ad3d6c7263e368abdc151e1cc13dc78aa39cc7a7.tar.xz
linux-dev-ad3d6c7263e368abdc151e1cc13dc78aa39cc7a7.zip
xarray: Add XArray load operation
The xa_load function brings with it a lot of infrastructure; xa_empty(), xa_is_err(), and large chunks of the XArray advanced API that are used to implement xa_load. As the test-suite demonstrates, it is possible to use the XArray functions on a radix tree. The radix tree functions depend on the GFP flags being stored in the root of the tree, so it's not possible to use the radix tree functions on an XArray. Signed-off-by: Matthew Wilcox <willy@infradead.org>
Diffstat (limited to 'tools/testing/radix-tree/xarray.c')
-rw-r--r--tools/testing/radix-tree/xarray.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/testing/radix-tree/xarray.c b/tools/testing/radix-tree/xarray.c
index 9bbd667172a7..e61e43efe463 100644
--- a/tools/testing/radix-tree/xarray.c
+++ b/tools/testing/radix-tree/xarray.c
@@ -4,4 +4,32 @@
* Copyright (c) 2018 Matthew Wilcox <willy@infradead.org>
*/
+#define XA_DEBUG
+#include "test.h"
+
+#define module_init(x)
+#define module_exit(x)
+#define MODULE_AUTHOR(x)
+#define MODULE_LICENSE(x)
+#define dump_stack() assert(0)
+
#include "../../../lib/xarray.c"
+#undef XA_DEBUG
+#include "../../../lib/test_xarray.c"
+
+void xarray_tests(void)
+{
+ xarray_checks();
+ xarray_exit();
+}
+
+int __weak main(void)
+{
+ radix_tree_init();
+ xarray_tests();
+ radix_tree_cpu_dead(1);
+ rcu_barrier();
+ if (nr_allocated)
+ printf("nr_allocated = %d\n", nr_allocated);
+ return 0;
+}