]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
rename mt_wr_split_data() to split_data_by_state()
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 6 May 2025 16:31:45 +0000 (12:31 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 6 May 2025 16:31:45 +0000 (12:31 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
lib/maple_tree.c

index 99081c1ee297ccca80f7c7d6d812e68a94a9964d..3f4bfefd33768f427daa37374d20c74e60e292fc 100644 (file)
@@ -3372,8 +3372,8 @@ void mni_cp(struct ma_node_info *src, struct ma_node_info *dst,
 struct split_data {
        /*
         * Used to split the data between two nodes.
-        * The user of this struct, mt_wr_split_data(), must keep track of the
-        * offset into the entire data (up to two nodes worth), so that the
+        * The user of this struct, split_data_by_state(), must keep track of
+        * the offset into the entire data (up to two nodes worth), so that the
         * insert can be placed in the correct place while the source data that
         * is overwritten is skipped.
         */
@@ -3681,7 +3681,7 @@ static void split_state_setup(struct ma_node_info *src,
 }
 
 /*
- * mt_wr_split_data() - Split the combined data into ma_node_state parts.
+ * split_data_by_state() - Split the combined data into ma_node_state parts.
  *
  * @src: The node information of the source
  * @left: The node information of the left destination
@@ -3707,7 +3707,7 @@ static void split_state_setup(struct ma_node_info *src,
  * Source is either a portion of the left or right source when rebalancing, or
  * just the one node being split.  It can also be the new data in @part.
  */
-static void mt_wr_split_data(struct ma_node_info *src,
+static void split_data_by_state(struct ma_node_info *src,
                struct ma_node_info *left, struct ma_node_info *right,
                struct ma_node_part *part, struct split_data *sd)
 {
@@ -3896,7 +3896,7 @@ bool mas_wr_try_rebalance(struct ma_state *mas, struct ma_node_info *src,
         * boundaries, or elsewhere.
         */
        sd->new_end += src2.end + 1;
-       mt_wr_split_data(src, left, right, part, sd);
+       split_data_by_state(src, left, right, part, sd);
        if (left_store) {
                /* Stored to the left, copy the last of the right in src2 */
                sd->states[sd->len].info = &src2;
@@ -4064,7 +4064,6 @@ static void mas_wr_rebalance(struct ma_wr_state *wr_mas)
        height = mas_mt_height(mas);
        mni_mas_init(&src, mas);
        src.end = mas->end;
-
        mns_node_part_leaf_init(&part, wr_mas, &src);
        sd.new_end = mas->end + part.size - part.skip + 1;
        sd.src_ins_end = wr_mas->offset_end;
@@ -4112,19 +4111,15 @@ static void mas_wr_rebalance(struct ma_wr_state *wr_mas)
                        goto new_root;
                }
 
-               sd.new_end = mas->end + part.size - part.skip + 1;
-               if (sd.new_end != mas->end) {
-                       printk("end is %u part %u skip %u\n", mas->end, part.size, part.skip);
-                       BUG_ON(1);
-               }
                if (mas->end > mt_min_slots[parent.type])
                        break;
 
                sd.len = 0;
+               src.end = mas->end;
+               sd.new_end = mas->end - 1;
                sd.offset = mas->offset;
                sd.src_ins_end = mas->offset + 1;
                mni_mas_init(&src, mas);
-               src.end = mas->end;
                mni_node_init(&left, mas_pop_node(mas), mte_node_type(mas->node));
        } while (height--);
 
@@ -4179,7 +4174,7 @@ static void mas_wr_split(struct ma_wr_state *wr_mas)
        sd.space = sd.split;
        sd.offset = 0;
 
-       mt_wr_split_data(&src, &left, &right, &part, &sd);
+       split_data_by_state(&src, &left, &right, &part, &sd);
        mns_assemble(sd.states, sd.len);
        mni_finalise(&left, &sd);
        mni_finalise(&right, &sd);
@@ -4211,7 +4206,7 @@ static void mas_wr_split(struct ma_wr_state *wr_mas)
                sd.space = sd.split;
                sd.offset = 0;
 
-               mt_wr_split_data(&src, &left, &right, &part, &sd);
+               split_data_by_state(&src, &left, &right, &part, &sd);
                mns_assemble(sd.states, sd.len);
                mni_finalise(&left, &sd);
                mni_finalise(&right, &sd);