return ret;
}
-static inline bool mas_search_slots(struct ma_state *mas, unsigned long val,
- enum maple_type type)
+static inline struct maple_node *mas_search_slots(struct ma_state *mas,
+ unsigned long val, enum maple_type type)
{
int i;
- bool ret = false;
unsigned char pivot_cnt = mt_pivots[type];
unsigned long pivot = 0;
pivot = _ma_get_pivot(mas->node, i, type);
if (i != 0 && pivot == 0) {
ma_set_slot(mas, MAPLE_NODE_SLOTS);
- return ret;
+ return NULL;
}
if (val <= pivot)
}
linear_node:
- if (_ma_get_rcu_slot(mas->node, i, type))
- ret = true;
-
ma_set_slot(mas, i);
- return ret;
+ return _ma_get_rcu_slot(mas->node, i, type);
}
-static inline bool mas_traverse(struct ma_state *mas, enum maple_type type)
+static inline bool mas_traverse(struct ma_state *mas, struct maple_node *next,
+ enum maple_type type)
{
- unsigned char slot = ma_get_slot(mas);
+ unsigned char slot;
- mas_update_limits(mas, slot, type);
if (type < maple_range_16)
return false;
- mas->node = _ma_get_rcu_slot(mas->node, slot, type);
+ slot = ma_get_slot(mas);
+ mas_update_limits(mas, slot, type);
+ mas->node = next;
return true;
}
{
mas->node = mas_start(mas);
enum maple_type type;
+ struct maple_node *next;
do {
type = mt_node_type(mas->node);
- if (!mas_search_slots(mas, mas->index, type))
+ next = mas_search_slots(mas, mas->index, type);
+ if (!next)
return type < maple_range_16;
- } while (mas_traverse(mas, type));
+ } while (mas_traverse(mas, next, type));
return true;
}