diff options
author | Matthew Wilcox <willy@infradead.org> | 2018-09-13 10:15:41 -0400 |
---|---|---|
committer | Matthew Wilcox <willy@infradead.org> | 2018-10-21 10:46:47 -0400 |
commit | ccc89e30fac790e3a175dbfc863c67286fce96b0 (patch) | |
tree | 55962e9b2c308a564e9d07613cef45fafe92b7ff /tools/testing/radix-tree | |
parent | 4bb53bdda0d1e061035774ed4868bdeb4d889044 (diff) | |
download | linux-ccc89e30fac790e3a175dbfc863c67286fce96b0.tar.gz linux-ccc89e30fac790e3a175dbfc863c67286fce96b0.tar.bz2 linux-ccc89e30fac790e3a175dbfc863c67286fce96b0.zip |
radix tree tests: Convert item_kill_tree to XArray
In preparation for the removal of the multiorder radix tree code,
convert item_kill_tree() to use the XArray so it can still be called
for XArrays containing multi-index entries.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Diffstat (limited to 'tools/testing/radix-tree')
-rw-r--r-- | tools/testing/radix-tree/test.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/tools/testing/radix-tree/test.c b/tools/testing/radix-tree/test.c index 5376b8c5d8d6..19045ce3bd23 100644 --- a/tools/testing/radix-tree/test.c +++ b/tools/testing/radix-tree/test.c @@ -252,31 +252,19 @@ void verify_tag_consistency(struct radix_tree_root *root, unsigned int tag) verify_node(node, tag, !!root_tag_get(root, tag)); } -void item_kill_tree(struct radix_tree_root *root) +void item_kill_tree(struct xarray *xa) { - struct radix_tree_iter iter; - void **slot; - struct item *items[32]; - int nfound; - - radix_tree_for_each_slot(slot, root, &iter, 0) { - if (xa_is_value(*slot)) - radix_tree_delete(root, iter.index); - } - - while ((nfound = radix_tree_gang_lookup(root, (void **)items, 0, 32))) { - int i; - - for (i = 0; i < nfound; i++) { - void *ret; + XA_STATE(xas, xa, 0); + void *entry; - ret = radix_tree_delete(root, items[i]->index); - assert(ret == items[i]); - free(items[i]); + xas_for_each(&xas, entry, ULONG_MAX) { + if (!xa_is_value(entry)) { + item_free(entry, xas.xa_index); } + xas_store(&xas, NULL); } - assert(radix_tree_gang_lookup(root, (void **)items, 0, 32) == 0); - assert(root->xa_head == NULL); + + assert(xa_empty(xa)); } void tree_verify_min_height(struct radix_tree_root *root, int maxindex) |