]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drop mas_wr_spanning_rebalance and inline it
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Wed, 24 Sep 2025 16:31:25 +0000 (12:31 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 2 Oct 2025 17:28:04 +0000 (13:28 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
lib/maple_tree.c

index 311fb58d9a5f8a3771d153718afbd69f61615af8..8949bf3f66fffcab69bc0233430b74cdca1daf75 100644 (file)
@@ -2874,34 +2874,6 @@ static bool spanning_ascend(struct maple_copy *cp, struct ma_state *mas,
        return true;
 }
 
-static void mas_wr_spanning_rebalance(struct ma_state *mas,
-               struct ma_wr_state *l_wr_mas, struct ma_wr_state *r_wr_mas)
-{
-       struct maple_enode *old_enode;
-       struct maple_copy cp;
-       struct ma_state sib;
-
-       /*
-        * Spanning store is different in that the write is actually from
-        * l_mas->index to r_mas->last - 1.  The -1 is because the last
-        * was incremented to get to the next node in the case of NULL entries
-        * being stored to the last slot of the left node.
-        */
-
-       cp_leaf_init(&cp, mas, l_wr_mas, r_wr_mas);
-       do {
-               spanning_data(&cp, l_wr_mas, r_wr_mas, &sib);
-               multi_src_setup(&cp, l_wr_mas, r_wr_mas, &sib);
-               dst_setup(&cp, mas, l_wr_mas->type);
-               cp_data_write(&cp, mas);
-       } while (spanning_ascend(&cp, mas, l_wr_mas, r_wr_mas, &sib));
-
-       old_enode = mas->node;
-       mas->node = cp.slot[0];
-       mas_wmb_replace(mas, old_enode, cp.height);
-       mtree_range_walk(mas);
-}
-
 /*
  * rebalance_ascend() - Ascend the tree and set up for the next loop - if
  * necessary
@@ -3242,6 +3214,7 @@ static void mas_wr_walk_index(struct ma_wr_state *wr_mas)
                mas_wr_walk_traverse(wr_mas);
        }
 }
+
 /*
  * mas_extend_spanning_null() - Extend a store of a %NULL to include surrounding %NULLs.
  * @l_wr_mas: The left maple write state
@@ -3384,7 +3357,10 @@ done:
  */
 static void mas_wr_spanning_store(struct ma_wr_state *wr_mas)
 {
+       struct maple_enode *old_enode;
+       struct maple_copy cp;
        struct ma_state *mas;
+       struct ma_state sib;
 
        /* Left and Right side of spanning store */
        MA_STATE(r_mas, NULL, 0, 0);
@@ -3441,7 +3417,26 @@ static void mas_wr_spanning_store(struct ma_wr_state *wr_mas)
                return mas_new_root(mas, wr_mas->entry);
        }
 
-       mas_wr_spanning_rebalance(mas, wr_mas, &r_wr_mas);
+
+       /*
+        * Spanning store is different in that the write is actually from
+        * l_mas->index to r_mas->last - 1.  The -1 is because the last
+        * was incremented to get to the next node in the case of NULL entries
+        * being stored to the last slot of the left node.
+        */
+
+       cp_leaf_init(&cp, mas, wr_mas, &r_wr_mas);
+       do {
+               spanning_data(&cp, wr_mas, &r_wr_mas, &sib);
+               multi_src_setup(&cp, wr_mas, &r_wr_mas, &sib);
+               dst_setup(&cp, mas, wr_mas->type);
+               cp_data_write(&cp, mas);
+       } while (spanning_ascend(&cp, mas, wr_mas, &r_wr_mas, &sib));
+
+       old_enode = mas->node;
+       mas->node = cp.slot[0];
+       mas_wmb_replace(mas, old_enode, cp.height);
+       mtree_range_walk(mas);
 }
 
 /*