ma_set_meta(node, mt, gap_slot, end - 1);
}
-static inline void append_node_cp(struct maple_copy *cp,
+static inline void append_mas_cp(struct maple_copy *cp,
struct ma_state *mas, unsigned char start, unsigned char end)
{
struct maple_node *node;
count = cp->s_count;
node = mas_mn(mas);
mt = mte_node_type(mas->node);
-
cp->src[count].node = node;
cp->src[count].mt = mt;
if (mas->end <= end)
cp->s_count++;
}
+static inline void append_wr_mas_cp(struct maple_copy *cp,
+ struct ma_wr_state *wr_mas, unsigned char start, unsigned char end)
+{
+ unsigned char count;
+
+ count = cp->s_count;
+ cp->src[count].node = wr_mas->node;
+ cp->src[count].mt = wr_mas->type;
+ if (wr_mas->mas->end <= end)
+ cp->src[count].max = wr_mas->mas->max;
+ else
+ cp->src[count].max = wr_mas->pivots[end];
+
+ cp->src[count].start = start;
+ cp->src[count].end = end;
+ cp->s_count++;
+}
+
static inline void cp_leaf_init(struct maple_copy *cp,
struct ma_state *mas, struct ma_wr_state *l_wr_mas,
struct ma_wr_state *r_wr_mas)
{
cp->s_count = 0;
if (sib->end && sib->max < l_wr_mas->mas->min)
- append_node_cp(cp, sib, 0, sib->end);
+ append_mas_cp(cp, sib, 0, sib->end);
/* Copy left 0 - offset */
if (l_wr_mas->mas->offset) {
unsigned char off = l_wr_mas->mas->offset - 1;
- append_node_cp(cp, l_wr_mas->mas, 0, off);
+ append_wr_mas_cp(cp, l_wr_mas, 0, off);
cp->src[cp->s_count - 1].max = cp->min - 1;
}
/* Copy right either from offset or offset + 1 pending on r_max */
if (r_wr_mas->mas->end != r_wr_mas->offset_end)
- append_node_cp(cp, r_wr_mas->mas, r_wr_mas->offset_end + 1,
+ append_wr_mas_cp(cp, r_wr_mas, r_wr_mas->offset_end + 1,
r_wr_mas->mas->end);
if (sib->end && sib->min > r_wr_mas->mas->max)
- append_node_cp(cp, sib, 0, sib->end);
+ append_mas_cp(cp, sib, 0, sib->end);
}
static inline