]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Retrun boolean from mas_rebalance()
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 7 Dec 2020 21:01:43 +0000 (16:01 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 5 Jan 2021 17:33:35 +0000 (12:33 -0500)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c

index d723576e9d37597de88c84a82f3c32d221e83346..073815614dc3ba37d51b0f8998497320dba5b052 100644 (file)
@@ -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;