]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Remove enc_full and just use mas->node.
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 25 Jan 2019 20:49:28 +0000 (15:49 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Wed, 31 Jul 2019 14:52:36 +0000 (10:52 -0400)
No need for this variable in mas_split.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c

index 0e87a093f137d5fc4c97e6ebc2def616df267dee..41488104a45983c57da496533e995a9ec7508bab 100644 (file)
@@ -504,7 +504,6 @@ static void ma_link(struct maple_node *new, struct maple_node *parent,
 static int ma_split(struct ma_state *mas, unsigned char slot,
                     unsigned char num, int depth)
 {
-       struct maple_node *enc_full = mas->node; // Encoded full node.
        struct maple_node *full = mt_to_node(mas->node);
        unsigned char split, p_slot = 0, p_end = 0;
        struct maple_node *old_parent, *new_parent, *left, *right;
@@ -518,8 +517,8 @@ static int ma_split(struct ma_state *mas, unsigned char slot,
                p_end = ma_data_end_r64(&old_parent->mr64, UINT_MAX);
                if (p_end >= MAPLE_RANGE64_SLOTS - 1) {
                        /* Must split the parent */
+                       p_slot = mt_parent_slot(mas->node);
                        ma_encoded_parent(mas);
-                       p_slot = mt_parent_slot(enc_full);
                        split = ma_split(mas, p_slot, p_end, 1);
                        if (mas_is_err(mas))
                                return 0;
@@ -531,7 +530,6 @@ static int ma_split(struct ma_state *mas, unsigned char slot,
                }
        }
 
-       enc_full = mas->node;
        mas_node_cnt(mas, 3);
        if (mas_is_err(mas))
                return 0;
@@ -542,13 +540,13 @@ static int ma_split(struct ma_state *mas, unsigned char slot,
        new_parent = ma_next_alloc(mas);
 
        // Record the node type for the children types.
-       ctype = mt_node_type(enc_full);
+       ctype = mt_node_type(mas->node);
        // copy the data and calculate the split location.
        split = ma_cp_data_64(mas, left, right, 0);
        // Copy the parents information
        if (!ma_is_root(full)) {
                // Copy the parent data and leave a hole.
-               p_slot = mt_parent_slot(enc_full);
+               p_slot = mt_parent_slot(mas->node);
                MA_CP(cp, old_parent, new_parent, 0, p_slot);
                ma_copy(mas, &cp);
                cp.dst_start += 1;