Lines Matching defs:root
44 radix_max(struct radix_tree_root *root)
46 return (1 << (root->height * RADIX_TREE_MAP_SHIFT)) - 1;
56 radix_tree_lookup(struct radix_tree_root *root, unsigned long index)
63 node = root->rnode;
64 height = root->height - 1;
65 if (index > radix_max(root))
77 radix_tree_delete(struct radix_tree_root *root, unsigned long index)
86 node = root->rnode;
87 height = root->height - 1;
88 if (index > radix_max(root))
110 if (node == root->rnode) {
111 root->rnode = NULL;
112 root->height = 0;
124 radix_tree_insert(struct radix_tree_root *root, unsigned long index, void *item)
135 /* get root node, if any */
136 node = root->rnode;
138 /* allocate root node, if any */
140 node = malloc(sizeof(*node), M_RADIX, root->gfp_mask | M_ZERO);
143 root->rnode = node;
144 root->height++;
148 while (radix_max(root) < index) {
151 if (root->height == RADIX_TREE_MAX_HEIGHT)
155 * If the root radix level is not empty, we need to
159 node = malloc(sizeof(*node), M_RADIX, root->gfp_mask | M_ZERO);
162 node->slots[0] = root->rnode;
164 root->rnode = node;
166 root->height++;
170 height = root->height - 1;
183 root->gfp_mask | M_ZERO);
187 /* check if we should free the root node aswell */
188 if (root->rnode->count == 0) {
189 free(root->rnode, M_RADIX);
190 root->rnode = NULL;
191 root->height = 0;