aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/radix-tree/multiorder.c
diff options
context:
space:
mode:
authorMatthew Wilcox <[email protected]>2018-09-13 03:29:32 +0000
committerMatthew Wilcox <[email protected]>2018-10-21 14:46:47 +0000
commit4bb53bdda0d1e061035774ed4868bdeb4d889044 (patch)
tree105026e609420e18c861295044b0f5f6ffdafe08 /tools/testing/radix-tree/multiorder.c
parentradix tree test suite: Remove multiorder benchmarking (diff)
downloadkernel-4bb53bdda0d1e061035774ed4868bdeb4d889044.tar.gz
kernel-4bb53bdda0d1e061035774ed4868bdeb4d889044.zip
radix tree tests: Move item_insert_order
The remaining tests are not suitable for moving in-kernel, so move item_insert_order() into multiorder.c, make it static and make it use the XArray. Signed-off-by: Matthew Wilcox <[email protected]>
Diffstat (limited to 'tools/testing/radix-tree/multiorder.c')
-rw-r--r--tools/testing/radix-tree/multiorder.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/testing/radix-tree/multiorder.c b/tools/testing/radix-tree/multiorder.c
index 6e8d66c2aa89..8c41dca272b1 100644
--- a/tools/testing/radix-tree/multiorder.c
+++ b/tools/testing/radix-tree/multiorder.c
@@ -20,6 +20,25 @@
#include "test.h"
+static int item_insert_order(struct xarray *xa, unsigned long index,
+ unsigned order)
+{
+ XA_STATE_ORDER(xas, xa, index, order);
+ struct item *item = item_create(index, order);
+
+ do {
+ xas_lock(&xas);
+ xas_store(&xas, item);
+ xas_unlock(&xas);
+ } while (xas_nomem(&xas, GFP_KERNEL));
+
+ if (!xas_error(&xas))
+ return 0;
+
+ free(item);
+ return xas_error(&xas);
+}
+
void multiorder_iteration(void)
{
RADIX_TREE(tree, GFP_KERNEL);