summaryrefslogtreecommitdiffstats
path: root/lib/radix-tree.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 /lib/radix-tree.c
parent992a8e60e3fea77c55589fc1c5af2304e78a5baa (diff)
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 'lib/radix-tree.c')
-rw-r--r--lib/radix-tree.c43
1 files changed, 0 insertions, 43 deletions
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 8a568cea1237..b8e961428484 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -256,49 +256,6 @@ static unsigned long next_index(unsigned long index,
256} 256}
257 257
258#ifndef __KERNEL__ 258#ifndef __KERNEL__
259static void dump_node(struct radix_tree_node *node, unsigned long index)
260{
261 unsigned long i;
262
263 pr_debug("radix node: %p offset %d indices %lu-%lu parent %p tags %lx %lx %lx shift %d count %d nr_values %d\n",
264 node, node->offset, index, index | node_maxindex(node),
265 node->parent,
266 node->tags[0][0], node->tags[1][0], node->tags[2][0],
267 node->shift, node->count, node->nr_values);
268
269 for (i = 0; i < RADIX_TREE_MAP_SIZE; i++) {
270 unsigned long first = index | (i << node->shift);
271 unsigned long last = first | ((1UL << node->shift) - 1);
272 void *entry = node->slots[i];
273 if (!entry)
274 continue;
275 if (entry == RADIX_TREE_RETRY) {
276 pr_debug("radix retry offset %ld indices %lu-%lu parent %p\n",
277 i, first, last, node);
278 } else if (!radix_tree_is_internal_node(entry)) {
279 pr_debug("radix entry %p offset %ld indices %lu-%lu parent %p\n",
280 entry, i, first, last, node);
281 } else if (xa_is_sibling(entry)) {
282 pr_debug("radix sblng %p offset %ld indices %lu-%lu parent %p val %p\n",
283 entry, i, first, last, node,
284 node->slots[xa_to_sibling(entry)]);
285 } else {
286 dump_node(entry_to_node(entry), first);
287 }
288 }
289}
290
291/* For debug */
292static void radix_tree_dump(struct radix_tree_root *root)
293{
294 pr_debug("radix root: %p xa_head %p tags %x\n",
295 root, root->xa_head,
296 root->xa_flags >> ROOT_TAG_SHIFT);
297 if (!radix_tree_is_internal_node(root->xa_head))
298 return;
299 dump_node(entry_to_node(root->xa_head), 0);
300}
301
302static void dump_ida_node(void *entry, unsigned long index) 259static void dump_ida_node(void *entry, unsigned long index)
303{ 260{
304 unsigned long i; 261 unsigned long i;