b_node->pivot[b_end] = mas->last;
piv = mas_get_safe_pivot(mas, slot);
-
if (piv > mas->last) {
b_node->slot[++b_end] = contents;
b_node->pivot[b_end] = piv;
return NULL; // spanning writes always overwrite something.
}
ret = mas_spanning_store(mas, entry);
- goto done;
+ goto exists;
}
/* At this point, we are at the leaf node that needs to be altered. */
content = mas_get_rcu_slot(mas, slot);
if (!overwrite && ((mas->last > r_max) || content )) {
mas_set_err(mas, -EEXIST);
- goto done;
+ goto exists;
}
if (!entry) {
mas_set_slot(mas, slot);
b_node.b_end = mas_store_b_node(mas, &b_node, entry);
b_node.min = mas->min;
+ b_node.type = mte_node_type(mas->node);
// Check if this is an append operation.
end = mas_data_end(mas);
mte_set_rcu_slot(mas->node, slot, entry);
mte_set_pivot(mas->node, slot, mas->last);
- goto done;
+ goto append;
}
// count the node as full if it has not already been counted.
if (b_node.b_end >= slot_cnt && end < slot_cnt)
mas_cnt_full(mas);
else if (b_node.b_end < mt_min_slot_cnt(mas->node))
- mas_cnt_empty(mas);
+ mas_cnt_empty(mas);
- b_node.type = mte_node_type(mas->node);
mas_commit_b_node(mas, &b_node);
if (mas_is_err(mas))
ret = 3;
-done:
if (mas_is_err(mas))
return NULL;
if (ret > 2)
return NULL;
+append:
+exists:
return content;
}