]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Cleaning
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 17 Jul 2020 21:22:55 +0000 (17:22 -0400)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 30 Oct 2020 19:05:30 +0000 (15:05 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c

index dfa44dc35bb85c84cdc93d896e34fcf5b9c5ac65..d0df92d408b8963a22d28be3eb8567769b0f169d 100644 (file)
@@ -1684,7 +1684,6 @@ static inline unsigned char mas_store_b_node(struct ma_state *mas,
        b_node->pivot[b_end] = mas->last;
 
        piv = mas_get_safe_pivot(mas, slot);
-
        if (piv > mas->last) {
                b_node->slot[++b_end] = contents;
                b_node->pivot[b_end] = piv;
@@ -2900,7 +2899,7 @@ static inline void *_mas_store(struct ma_state *mas, void *entry, bool overwrite
                        return NULL; // spanning writes always overwrite something.
                }
                ret = mas_spanning_store(mas, entry);
-               goto done;
+               goto exists;
        }
 
        /* At this point, we are at the leaf node that needs to be altered. */
@@ -2910,7 +2909,7 @@ static inline void *_mas_store(struct ma_state *mas, void *entry, bool overwrite
        content = mas_get_rcu_slot(mas, slot);
        if (!overwrite && ((mas->last > r_max) || content )) {
                mas_set_err(mas, -EEXIST);
-               goto done;
+               goto exists;
        }
 
        if (!entry) {
@@ -2922,6 +2921,7 @@ static inline void *_mas_store(struct ma_state *mas, void *entry, bool overwrite
        mas_set_slot(mas, slot);
        b_node.b_end = mas_store_b_node(mas, &b_node, entry);
        b_node.min = mas->min;
+       b_node.type = mte_node_type(mas->node);
 
        // Check if this is an append operation.
        end = mas_data_end(mas);
@@ -2931,26 +2931,26 @@ static inline void *_mas_store(struct ma_state *mas, void *entry, bool overwrite
 
                mte_set_rcu_slot(mas->node, slot, entry);
                mte_set_pivot(mas->node, slot, mas->last);
-               goto done;
+               goto append;
        }
 
        // count the node as full if it has not already been counted.
        if (b_node.b_end >= slot_cnt && end < slot_cnt)
                mas_cnt_full(mas);
        else if (b_node.b_end < mt_min_slot_cnt(mas->node))
-                mas_cnt_empty(mas);
+               mas_cnt_empty(mas);
 
-       b_node.type = mte_node_type(mas->node);
        mas_commit_b_node(mas, &b_node);
        if (mas_is_err(mas))
                ret = 3;
 
-done:
        if (mas_is_err(mas))
                return NULL;
 
        if (ret > 2)
                return NULL;
+append:
+exists:
 
        return content;
 }