}
/*
- * mas_first_entry() - * Returns the pivot which points to the entry with the
- * lowest index.
+ * mas_first_entry() - Go the first leaf and find the first entry.
*
* @mas: the maple state.
* @limit: the maximum index to check.
+ * Returns: The start of the pivot.
*/
static inline unsigned long mas_first_entry(struct ma_state *mas,
unsigned long limit)
{
void **slots, *entry;
int offset = 0;
- unsigned long pivot = mas->min;
+ unsigned long prev_piv = mas->min;
while (!mte_is_leaf(mas->node)) {
mas->max = mte_pivot(mas->node, 0);
slots = ma_slots(mte_to_node(mas->node), mte_node_type(mas->node));
- while ((pivot < limit) && (offset < mt_slot_count(mas->node))) {
- pivot = mas_safe_pivot(mas, offset);
+ while ((prev_piv < limit) && (offset < mt_slot_count(mas->node))) {
entry = mas_slot(mas, slots, offset);
if (entry) {
mas_set_offset(mas, offset);
- return pivot;
+ return prev_piv;
}
+ prev_piv = mas_safe_pivot(mas, offset);
offset++;
}
mas->node = MAS_NONE;
- return pivot;
+ return prev_piv;
}
/*