{
enum maple_type type;
struct maple_node *next;
- unsigned long pivot_cnt, pivot, max, min, i;
- bool ret = true;
+ unsigned long pivot = 0;
+ unsigned long pivot_cnt, max, min, i;
+ bool ret = false;
mas->node = mas_start(mas);
min = mas->min;
switch (type) {
default:
- pivot = 0;
for (i = 0; i < pivot_cnt; i++) {
pivot = _ma_get_pivot(mas->node, i, type);
if (i != 0 && pivot == 0) {
- ma_set_slot(mas, MAPLE_NODE_SLOTS);
- return NULL;
+ i = MAPLE_NODE_SLOTS;
+ goto done;
}
if (mas->index <= pivot) {
if ((i == pivot_cnt - 1) && (mas->index > pivot))
i++;
- if (type < maple_range_16) // Leaf.
+ if (type < maple_range_16) { // Leaf.
+ ret = true;
goto done;
+ }
break;
case maple_dense:
// Linear node.
i = mas->index - mas->min;
+ ret = true;
goto done;
break;
}
mas->node = mas_start(mas);
if (!xa_is_node(rcu_dereference(mas->tree->ma_root))) {
- if (mas->last == 0) {
- if (mas->node != NULL)
- goto exists;
-
- if (((unsigned long) (entry) & 3) == 2)
- ma_root_expand(mas, entry);
- else
- rcu_assign_pointer(mas->tree->ma_root, entry);
-
+ if (mas->last != 0) {
+ ma_root_expand(mas, entry);
return;
}
- ma_root_expand(mas, entry);
+
+ if (mas->node != NULL)
+ goto exists;
+
+ if (((unsigned long) (entry) & 3) == 2)
+ ma_root_expand(mas, entry);
+ else
+ rcu_assign_pointer(mas->tree->ma_root, entry);
+
return;
}