struct maple_enode *p = __ma_get_rcu_slot(mn, slot, type);
if (mt_dead_node(mn))
- return NULL;
+ return MAS_START;
return p;
}
no_entry:
return false;
}
+
static inline unsigned long
mas_next_entry (struct ma_state *mas, unsigned long max)
{
}
return pivot;
}
+static inline unsigned long
+mas_safe_next_entry (struct ma_state *mas, unsigned long max)
+{
+ unsigned long piv;
+retry:
+ piv = mas_next_entry(mas, max);
+ if (mas->node == MAS_NONE)
+ return piv;
+ if (mas_dead_node(mas, mas->index))
+ goto retry;
+ return piv;
+}
/* Private
* Combine nulls with the same pivot value
*
if (mas->node == MAS_START) {
_mas_walk(mas);
+ do {} while(mas_dead_node(mas, mas->index));
+
slot = ma_get_slot(mas);
+
last_piv = ma_get_safe_pivot(mas, slot);
if (slot != MAPLE_NODE_SLOTS)
entry = ma_get_rcu_slot(mas->node, slot);
}
}
- last_piv = mas_next_entry(mas, max);
- if (mas->node == MAS_NONE) {
+ last_piv = mas_safe_next_entry(mas, max);
+ if (mas->node == MAS_NONE)
goto not_found;
- }
+
slot = ma_get_slot(mas);
entry = ma_get_rcu_slot(mas->node, slot);
if (!entry)
goto not_found;
+
mas->index = ma_get_prev_pivot(mas, slot) + 1;
done:
mas->last = last_piv;
rcu_read_lock();
_mas_walk(&mas);
+ do {} while (mas_dead_node(&mas, mas.index));
+
slot = ma_get_slot(&mas);
if (slot != MAPLE_NODE_SLOTS)
entry = ma_get_rcu_slot(mas.node, slot);
+
if (xa_is_zero(entry))
entry = NULL;
goto done;
retry:
- mas_next_entry(&mas, max);
+ mas_safe_next_entry(&mas, max);
if (mas.node == MAS_NONE)
goto done;
+
slot = ma_get_slot(&mas);
entry = ma_get_rcu_slot(mas.node, slot);
if (xa_is_zero(entry))
_mas_walk(&mas);
retry:
ma_set_slot(&mas, ma_get_slot(&mas) + 1);
- mas_next_entry(&mas, max);
+ mas_safe_next_entry(&mas, max);
if (mas.node == MAS_NONE)
goto done;