]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Small cleanup of code and comments
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 29 Jan 2019 20:28:36 +0000 (15:28 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Wed, 31 Jul 2019 14:52:37 +0000 (10:52 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c

index a07b73462e781225db030f776f1b34a59ee2a85f..76280416b03131bdb07425e04bce25c4f2805a07 100644 (file)
@@ -526,9 +526,9 @@ static int ma_split(struct ma_state *mas, unsigned char slot,
                old_parent = mt_parent(mas->node);
                p_slot = mt_parent_slot(mas->node);
                p_end = ma_data_end_r64(&old_parent->mr64, UINT_MAX);
+               ma_encoded_parent(mas);
                if (p_end >= MAPLE_RANGE64_SLOTS - 1) {
                        /* Must split the parent */
-                       ma_encoded_parent(mas);
                        split = ma_split(mas, p_slot, p_end, 1);
                        if (mas_is_err(mas))
                                return 0;
@@ -536,8 +536,6 @@ static int ma_split(struct ma_state *mas, unsigned char slot,
                                p_slot -= split;
                        // Split will return the parent.
                        old_parent = mt_to_node(mas->node);
-               } else {
-                       ma_encoded_parent(mas);
                }
                ptype = mt_node_type(mas->node);
                mas->node = old_parent->mr64.slot[p_slot];
@@ -588,14 +586,13 @@ static int ma_split(struct ma_state *mas, unsigned char slot,
 
        ma_link(left, new_parent, p_slot, pivot, ctype);
 
-       // Set up maple state for replacement of node.
-       // Note: old_parent may be the old parent or the full node.
+       // Set up maple state to replace the parent node in the grandparent.
        mas->node = mt_mk_node(new_parent, ptype);
        // Replace the parent node & free the old parent.
        mt_replace(mas);
 
        // Set up the ma_state for the return.  Point to the correct node for
-       // the insert.
+       // the insert or subsequent split.
        if (mas->index <= pivot)
                mas->node = mt_mk_node(left, ctype);
        else