When splitting a node, ensure a deficient node is not created when a
NULL in encountered at the split. Also adjust the checking of the limit
when incrementing to ensure both the min and the number on the right are
zero based.
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
/* If the split is less than the max slot && the right side will
* still be sufficient, then increment the split on NULL.
*/
- if ((split < slot_cnt - 1) &&
+ if ((split < mt_slots[b_node->type] - 1) &&
(b_node->b_end - split) < (mt_min_slots[b_node->type]))
split++;
else
*/
while (((b_node->pivot[split] - b_node->min) < slot_cnt - 1) &&
(split < slot_cnt - 1) &&
- (b_node->b_end - split > mt_min_slots[b_node->type]))
+ (b_node->b_end - split > mt_min_slots[b_node->type] - 1))
split++;
}