diff options
author | Keir Fraser <keir@xen.org> | 2011-05-02 12:00:40 +0100 |
---|---|---|
committer | Keir Fraser <keir@xen.org> | 2011-05-02 12:00:40 +0100 |
commit | d0ef88916f3ab8bda754b175b299e3d5a73fe851 (patch) | |
tree | 1ca943cf84f69289ffda79497151277a64c35583 /xen/common/radix-tree.c | |
parent | 76ce27755b87aa5a91ce0f5a02e560ab5c0515e4 (diff) | |
download | xen-d0ef88916f3ab8bda754b175b299e3d5a73fe851.tar.gz xen-d0ef88916f3ab8bda754b175b299e3d5a73fe851.tar.bz2 xen-d0ef88916f3ab8bda754b175b299e3d5a73fe851.zip |
Revert 23295:4891f1f41ba5 and 23296:24346f749826
Fails current lock checking mechanism in spinlock.c in debug=y builds.
Signed-off-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/common/radix-tree.c')
-rw-r--r-- | xen/common/radix-tree.c | 44 |
1 files changed, 6 insertions, 38 deletions
diff --git a/xen/common/radix-tree.c b/xen/common/radix-tree.c index f2736d9a00..e6e213c0a0 100644 --- a/xen/common/radix-tree.c +++ b/xen/common/radix-tree.c @@ -26,6 +26,7 @@ * o tagging code removed * o radix_tree_insert has func parameter for dynamic data struct allocation * o radix_tree_destroy added (including recursive helper function) + * o __init functions must be called explicitly * o other include files adapted to Xen */ @@ -34,7 +35,6 @@ #include <xen/lib.h> #include <xen/types.h> #include <xen/errno.h> -#include <xen/xmalloc.h> #include <xen/radix-tree.h> #include <asm/cache.h> @@ -49,18 +49,6 @@ static inline unsigned long radix_tree_maxindex(unsigned int height) return height_to_maxindex[height]; } -static struct radix_tree_node *_node_alloc(void *unused) -{ - struct radix_tree_node *node = xmalloc(struct radix_tree_node); - - return node ? memset(node, 0, sizeof(*node)) : node; -} - -static void _node_free(struct radix_tree_node *node) -{ - xfree(node); -} - /* * Extend a radix tree so it can store key @index. */ @@ -112,9 +100,6 @@ int radix_tree_insert(struct radix_tree_root *root, unsigned long index, int offset; int error; - if (!node_alloc) - node_alloc = _node_alloc; - /* Make sure the tree is high enough. */ if (index > radix_tree_maxindex(root->height)) { error = radix_tree_extend(root, index, node_alloc, arg); @@ -225,8 +210,7 @@ EXPORT_SYMBOL(radix_tree_lookup); static unsigned int __lookup(struct radix_tree_root *root, void **results, unsigned long index, - unsigned int max_items, unsigned long *indexes, - unsigned long *next_index) + unsigned int max_items, unsigned long *next_index) { unsigned int nr_found = 0; unsigned int shift, height; @@ -236,11 +220,8 @@ __lookup(struct radix_tree_root *root, void **results, unsigned long index, height = root->height; if (index > radix_tree_maxindex(height)) if (height == 0) { - if (root->rnode && index == 0) { - if (indexes) - indexes[nr_found] = index; + if (root->rnode && index == 0) results[nr_found++] = root->rnode; - } goto out; } @@ -269,8 +250,6 @@ __lookup(struct radix_tree_root *root, void **results, unsigned long index, for (i = index & RADIX_TREE_MAP_MASK; i < RADIX_TREE_MAP_SIZE; i++) { index++; if (slot->slots[i]) { - if (indexes) - indexes[nr_found] = index - 1; results[nr_found++] = slot->slots[i]; if (nr_found == max_items) goto out; @@ -287,7 +266,6 @@ __lookup(struct radix_tree_root *root, void **results, unsigned long index, * @results: where the results of the lookup are placed * @first_index: start the lookup from this key * @max_items: place up to this many items at *results - * @indexes: (optional) array to store indexes of items. * * Performs an index-ascending scan of the tree for present items. Places * them at *@results and returns the number of items which were placed at @@ -297,8 +275,7 @@ __lookup(struct radix_tree_root *root, void **results, unsigned long index, */ unsigned int radix_tree_gang_lookup(struct radix_tree_root *root, void **results, - unsigned long first_index, unsigned int max_items, - unsigned long *indexes) + unsigned long first_index, unsigned int max_items) { const unsigned long max_index = radix_tree_maxindex(root->height); unsigned long cur_index = first_index; @@ -311,7 +288,7 @@ radix_tree_gang_lookup(struct radix_tree_root *root, void **results, if (cur_index > max_index) break; nr_found = __lookup(root, results + ret, cur_index, - max_items - ret, indexes + ret, &next_index); + max_items - ret, &next_index); ret += nr_found; if (next_index == 0) break; @@ -359,9 +336,6 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index, unsigned int height, shift; int offset; - if (!node_free) - node_free = _node_free; - height = root->height; if (index > radix_tree_maxindex(height)) goto out; @@ -446,8 +420,6 @@ void radix_tree_destroy(struct radix_tree_root *root, if (root->height == 0) slot_free(root->rnode); else { - if (!node_free) - node_free = _node_free; radix_tree_node_destroy(root->rnode, root->height, slot_free, node_free); node_free(root->rnode); @@ -468,14 +440,10 @@ static unsigned long __init __maxindex(unsigned int height) return index; } -static int __init radix_tree_init(void) +void __init radix_tree_init(void) { unsigned int i; for (i = 0; i < ARRAY_SIZE(height_to_maxindex); i++) height_to_maxindex[i] = __maxindex(i); - - return 0; } -/* pre-SMP just so it runs before 'normal' initcalls */ -presmp_initcall(radix_tree_init); |