mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
radix tree test suite: Convert iteration test to XArray
With no code left in the kernel using the multiorder radix tree, convert the iteration test from the radix tree to the XArray. It's unlikely to suffer the same bug as the radix tree, but this test will prevent that bug from ever creeping into the XArray implementation. Signed-off-by: Matthew Wilcox <willy@infradead.org>
This commit is contained in:
parent
372266ba02
commit
47e0fab2b1
3 changed files with 63 additions and 58 deletions
|
@ -63,16 +63,21 @@ void item_sanity(struct item *item, unsigned long index)
|
|||
assert((item->index | mask) == (index | mask));
|
||||
}
|
||||
|
||||
void item_free(struct item *item, unsigned long index)
|
||||
{
|
||||
item_sanity(item, index);
|
||||
free(item);
|
||||
}
|
||||
|
||||
int item_delete(struct radix_tree_root *root, unsigned long index)
|
||||
{
|
||||
struct item *item = radix_tree_delete(root, index);
|
||||
|
||||
if (item) {
|
||||
item_sanity(item, index);
|
||||
free(item);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
if (!item)
|
||||
return 0;
|
||||
|
||||
item_free(item, index);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void item_free_rcu(struct rcu_head *head)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue