outline
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Wed, 16 Apr 2025 14:53:45 +0000 (10:53 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Wed, 16 Apr 2025 14:53:45 +0000 (10:53 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
lib/maple_tree.c

index e70e863b4c27cb1e08a52f9fd28343f3ce4489e5..88467f48b68eb0fc58b9e145d3fa3feba31f71f8 100644 (file)
@@ -3883,6 +3883,7 @@ static void mt_wr_split_data(struct ma_node_info *src,
        to = left;
        node_off = 0; /* src */
        part_off = 0;
+       printk("sd off %u in %u in_end %u\n", sd->offset, sd->insert, insert_end);
        do {
                unsigned char copied = 0;
 
@@ -3942,6 +3943,7 @@ static void mt_wr_split_data(struct ma_node_info *src,
                        sd->split = 255;
                }
                sd->len++;
+               printk("node off %u src end %u\n", node_off, src->end);
        } while (node_off <= src->end);
 }
 
@@ -4075,11 +4077,46 @@ static void mas_wr_rebalance(struct ma_wr_state *wr_mas)
         */
        mt_dump(mas->tree, mt_dump_dec);
 
+       height = mas_mt_height(mas);
        mas->depth = height;
 
+       /*
+        * allocate left
+        * set alloc in left
+        * figure out src2
+        * rebalance leaves {
+        *   allocate right, if needed
+        *   set right alloc to left value
+        *   set up split data
+        *   split the data
+        *   set up part
+        * }
+        *
+        * while ( parent is insufficient including overwrite, extra part) {
+        *  allocate left
+        *  figure out src2
+        *  rebalance src and src 2 {
+        *   allocate right, if needed
+        *   set right alloc to left value
+        *   set up split data
+        *   split the data and insert part
+        *   set up next part
+        *  }
+        *
+        * allocate new parent
+        * converge
+        *   copy to insert
+        *   insert part
+        *   skip entry (or 2)
+        *   copy to end
+        * put in tree
+        *
+        */
+
        mni_mas_init(&src, mas);
        tmp_mas = *mas;
        while (height--) {
+               printk("height %d\n", height);
                mas_wr_ascend_init(&tmp_mas, &parent);
                max = mt_slots[src.type] - 1;
                if (ma_is_leaf(src.type))
@@ -4163,6 +4200,7 @@ static void mas_wr_rebalance(struct ma_wr_state *wr_mas)
                         * Absorb all the data from two nodes, which may need
                         * more rebalancing
                         */
+                       printk("Absorb src %p src2 %p\n", src.node, src2.node);
                        sd.split = sd.new_end + 2; /* No split */
 
                        if (!left_store) {