unsigned char offset;
unsigned long index;
- pivots = ma_pivots(node, type);
if (unlikely(ma_is_dense(type))) {
(*range_max) = (*range_min) = mas->index;
if (unlikely(ma_dead_node(node)))
offset = 0;
min = mas->min;
+ pivots = ma_pivots(node, type);
max = pivots[offset];
if (unlikely(ma_dead_node(node)))
return;
max = mas->max;
done:
- *range_max = max;
- *range_min = min;
mas->offset = offset;
+ if (ma_is_leaf(type)) {
+ *range_max = max;
+ *range_min = min;
+ } else {
+ mas->max = max;
+ mas->min = min;
+ }
}
/*
* __mas_walk(): Locates a value and sets the mas->node and slot accordingly.
/* Descend. */
mas->node = next;
- mas->max = *range_max;
- mas->min = *range_min;
- mas->offset = 0;
}
return false;
}
ma_set_meta(newnode, maple_leaf_64, 0, new_end);
}
- if (!mt_in_rcu(mas->tree)) {
- memcpy(mas_mn(mas), newnode, sizeof(struct maple_node));
- } else {
+ if (likely(mt_in_rcu(mas->tree))) {
mas->node = mt_mk_node(newnode, mt);
mas_replace(mas, false);
+ } else {
+ memcpy(mas_mn(mas), newnode, sizeof(struct maple_node));
}
trace_ma_write(__func__, mas, 0, entry);
mas_update_gap(mas);