unsigned long min; /* The minimum index of this node - implied pivot min */
unsigned long max; /* The maximum index of this node - implied pivot max */
struct maple_node *alloc; /* Allocated nodes for this operation */
- struct maple_enode *span_enode; /* Pointer to maple parent/slot that set the max */
unsigned char depth; /* depth of tree descent during write */
};
/*
*
- * mas_is_span_() - Set span_enode if there is no value already and the
+ * mas_is_span_() - Check if the write spans the node.
* entry being written spans this nodes slot or touches the end of this slot and
* is NULL.
* @piv - the pivot of the slot in this node
}
trace_mas_is_span_wr(mas, piv, entry);
- mas->span_enode = mas->node;
return true;
}
{
enum maple_type type;
- mas->span_enode = NULL;
while (true) {
type = mte_node_type(mas->node);
mas->depth++;
- if (unlikely(!mas_node_walk(mas, type, range_min, range_max)))
- return false;
-
+ mas_node_walk(mas, type, range_min, range_max);
if (mas_is_span_wr(mas, *range_max, type, entry))
- return ma_is_leaf(type);
+ return false;
if (ma_is_leaf(type))
- return true;
+ break;
// Traverse.
mas->max = *range_max;
mas->node = mas_get_slot(mas, mas_offset(mas));
mas_set_offset(mas, 0);
}
- return false;
+ return true;
}
static inline void mas_extend_null(struct ma_state *l_mas, struct ma_state *r_mas)
goto complete_at_root;
}
- if (!mas_wr_walk(mas, &r_min, &r_max, entry) && !mas->span_enode)
- return NULL;
-
- if (mas->span_enode) {
+ if (!mas_wr_walk(mas, &r_min, &r_max, entry)) {
if (!overwrite) {
mas_set_err(mas, -EEXIST);
return NULL; // spanning writes always overwrite something.