]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: mas_spanning_store() cleanup a bit
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Wed, 24 Nov 2021 15:59:55 +0000 (10:59 -0500)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Wed, 24 Nov 2021 15:59:55 +0000 (10:59 -0500)
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
lib/maple_tree.c

index 6de4300996b505b6fc873822a3568ec6c0577f1b..30a5599acc9de434b7e0ec2a5176a1b2039c76b4 100644 (file)
@@ -3853,7 +3853,11 @@ static inline int mas_spanning_store(struct ma_wr_state *wr_mas)
        if (mas_is_err(mas))
                return 0;
 
-       /* Set up right side. */
+       /*
+        * Set up right side.  Need to get to the next offset after the spanning
+        * store to ensure it's not NULL and to combine both the next node and
+        * the node with the start together.
+        */
        r_mas = *mas;
        /* Avoid overflow, walk to next slot in the tree. */
        if (r_mas.last + 1)
@@ -3861,7 +3865,7 @@ static inline int mas_spanning_store(struct ma_wr_state *wr_mas)
 
        r_mas.index = r_mas.last;
        r_wr_mas.mas = &r_mas;
-       mas_wr_walk(&r_wr_mas);
+       mas_wr_walk_index(&r_wr_mas);
        r_mas.last = r_mas.index = mas->last;
 
        /* Set up left side. */
@@ -3875,8 +3879,7 @@ static inline int mas_spanning_store(struct ma_wr_state *wr_mas)
                mas->offset = l_mas.offset;
                mas->index = l_mas.index;
                mas->last = l_mas.last = r_mas.last;
-       } else
-               l_mas.last = mas->last;
+       }
 
        /* Copy l_mas and store the value in b_node. */
        b_node.b_end = mas_store_b_node(&l_wr_mas, &b_node, l_wr_mas.node_end);