Skip to contentSkip to conversation

radix tree test suite: handle exceptional entries

PATCH New [email protected] 1 participant 1 message Dec 14, 2016 Xarray

lore
Share & tools
lore
#0 lore raw

PATCH 88/114 radix tree test suite: handle exceptional entries

From: Matthew Wilcox <[email protected]>
Subject: radix tree test suite: handle exceptional entries

item_kill_tree() assumes that everything in the tree is a pointer to a struct item, which is annoying when testing the behaviour of exceptional entries. Fix it to delete exceptional entries on the assumption they don't need to be freed.

---

 tools/testing/radix-tree/test.c |    7 +++++++
 1 file changed, 7 insertions(+)
tools/testing/radix-tree/test.c renamed from tools/testing/radix-tree/test.c~radix-tree-test-suite-handle-exceptional-entries +7 -0
diff -puN tools/testing/radix-tree/test.c~radix-tree-test-suite-handle-exceptional-entries tools/testing/radix-tree/test.c
@@ -200,9 +200,16 @@ void verify_tag_consistency(struct radix
 
 void item_kill_tree(struct radix_tree_root *root)
 {
+	struct radix_tree_iter iter;
+	void **slot;
 	struct item *items[32];
 	int nfound;
 
+	radix_tree_for_each_slot(slot, root, &iter, 0) {
+		if (radix_tree_exceptional_entry(*slot))
+			radix_tree_delete(root, iter.index);
+	}
+
 	while ((nfound = radix_tree_gang_lookup(root, (void **)items, 0, 32))) {
 		int i;
 

_