When expanding a null write to ULONG_MAX, it may cause the metadata
calculation to be off by one. Fix this issue by detecting the offset
with write maple state end_piv instead of reading the node data.
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
new_end++;
} else {
- if (mas_safe_pivot(mas, wr_mas->pivots, wr_mas->offset_end,
- wr_mas->type) == mas->last)
+ if (wr_mas->end_piv == mas->last)
wr_mas->offset_end++;
new_end -= wr_mas->offset_end - offset - 1;
mas->last = mas->max;
else
mas->last = wr_mas->pivots[wr_mas->offset_end];
+ wr_mas->end_piv = mas->last;
} else if ((mas->last > wr_mas->end_piv) &&
!wr_mas->slots[wr_mas->offset_end]) {
mas->last = wr_mas->end_piv;