From: Liam R. Howlett Date: Mon, 7 Dec 2020 21:01:43 +0000 (-0500) Subject: maple_tree: Retrun boolean from mas_rebalance() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=cd7b8880637313a357ed76349bd2c65664c07b4e;p=users%2Fjedix%2Flinux-maple.git maple_tree: Retrun boolean from mas_rebalance() Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index d723576e9d37..073815614dc3 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2446,8 +2446,7 @@ new_root: * * Returns the number of elements in b_node during the last loop. */ -static inline int mas_rebalance(struct ma_state *mas, - struct maple_big_node *b_node) +static inline int mas_rebalance(struct ma_state *mas, struct maple_big_node *b_node) { char empty_count = mas_mt_height(mas); struct maple_subtree_state mast; @@ -2695,7 +2694,7 @@ static inline bool mas_push_data(struct ma_state *mas, int height, unsigned char end, space, split; MA_STATE(tmp_mas, mas->tree, mas->index, mas->last); - mas_dup_state(&tmp_mas, mast->l); // for depth. + tmp_mas.depth = mast->l->depth; tmp_mas.node = mas->node; if (left && !mas_prev_sibling(&tmp_mas)) @@ -2797,15 +2796,15 @@ static int mas_split(struct ma_state *mas, struct maple_big_node *b_node) mas_dup_state(&l_mas, mas); mas_dup_state(&r_mas, mas); - mast.l->node = mas_new_ma_node(mas, b_node); - mast.r->node = mas_new_ma_node(mas, b_node); + l_mas.node = mas_new_ma_node(mas, b_node); + r_mas.node = mas_new_ma_node(mas, b_node); if (mas_push_left(mas, height, &mast)) break; if (mas_push_right(mas, height, &mast)) break; - split = mab_calc_split(mas, mast.bn, &mid_split); + split = mab_calc_split(mas, b_node, &mid_split); mast_split_data(&mast, mas, split); // Usually correct, mab_mas_cp in the above call overwrites r->max. mast.r->max = mas->max;