if (pivots[end] != mas->max)
end++;
- ma_set_meta(node, mt, 0, end);
+ if (end < mt_slots[mt] - 1)
+ ma_set_meta(node, mt, 0, end);
}
}
node->parent = mas_mn(mas)->parent;
mas->node = mt_mk_node(node, b_type);
mab_mas_cp(b_node, 0, b_end, mas, true);
- if (b_end < mt_pivots[b_type] - 1)
- ma_set_meta(node, b_type, 0, b_end);
mas_replace(mas, false);
reuse_node:
{
unsigned char zero;
unsigned char node_slots;
+ unsigned char node_size;
struct ma_state *mas = wr_mas->mas;
struct maple_big_node b_node;
/* Attempt to append */
node_slots = mt_slots[wr_mas->type];
+ node_size = wr_mas->node_end - wr_mas->offset_end + mas->offset + 2;
+ if (mas->max == ULONG_MAX)
+ node_size++;
+
/* slot and node store will not fit, go to the slow path */
- if (unlikely(wr_mas->offset_end + 1 >= node_slots))
+ if (unlikely(node_size >= node_slots))
goto slow_path;
if (wr_mas->entry && (wr_mas->node_end < node_slots - 1) &&