* @r_wr_mas: The maple write state containing the data to the right of the
* write
*
- * cp->data will not be 0 indexed.
+ * cp->data is a size (not indexed by 0).
*/
static inline void cp_data_calc(struct maple_copy *cp,
*
* Note that it is still possible to get a full node on the left by the
* NULL landing exactly on the split. The NULL ending of a node happens
- * in the multi_dst_setup() function, where we will either increase the
- * split by one or decrease it by one, if possible. In the case of
- * split (this case), it is always possible to shift the spilt by one -
- * again because there is at least one slot free by the below checking.
+ * in the dst_setup() function, where we will either increase the split
+ * by one or decrease it by one, if possible. In the case of split
+ * (this case), it is always possible to shift the spilt by one - again
+ * because there is at least one slot free by the below checking.
*/
if (new_data < space)
return true;
struct ma_wr_state *wr_mas, struct ma_state *sib)
{
cp_data_calc(cp, wr_mas, wr_mas);
-
sib->end = 0;
if (cp->data >= mt_slots[wr_mas->type]) {
push_data_sib(cp, wr_mas->mas, sib);
}
return;
+
use_sib:
cp->data += sib->end + 1;
}
struct ma_state *sib)
{
cp_data_calc(cp, l_wr_mas, r_wr_mas);
-
if (((l_wr_mas->mas->min != 0) || (r_wr_mas->mas->max != ULONG_MAX)) &&
(cp->data <= mt_min_slots[l_wr_mas->type])) {
spanning_sib(l_wr_mas, r_wr_mas, sib);
} else {
sib->end = 0;
}
-
}
+/*
+ * dst_setup() - Set up multiple destinations for the new data. This is
+ * called when the node is split or rebalanced.
+ */
static inline
-void multi_dst_setup(struct maple_copy *cp, struct ma_state *mas,
- enum maple_type mt)
+void dst_setup(struct maple_copy *cp, struct ma_state *mas, enum maple_type mt)
{
/* Data is 1 indexed, every src has +1 added. */
cp->data = cp->d_count;
cp->s_count = 0;
- multi_dst_setup(cp, mas, mt);
+ dst_setup(cp, mas, mt);
spanning_init_cp_src(cp);
node_copy(mas, cp->src[0].node, 0, cp->data, cp->max, maple_copy,
cp->dst[0].node, 0, mt);
do {
spanning_data_calc(&cp, l_wr_mas, r_wr_mas, &sib);
multi_src_setup(&cp, l_wr_mas, r_wr_mas, &sib);
- multi_dst_setup(&cp, mas, l_wr_mas->type);
+ 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));
do {
split_data_calc(&cp, wr_mas, &sib);
multi_src_setup(&cp, wr_mas, wr_mas, &sib);
- multi_dst_setup(&cp, mas, wr_mas->type);
+ dst_setup(&cp, mas, wr_mas->type);
cp_data_write(&cp, mas);
} while (split_ascend(&cp, wr_mas, &sib));
do {
rebalance_data_calc(&cp, wr_mas, &sib);
multi_src_setup(&cp, wr_mas, wr_mas, &sib);
- multi_dst_setup(&cp, mas, wr_mas->type);
+ dst_setup(&cp, mas, wr_mas->type);
cp_data_write(&cp, mas);
} while (rebalance_ascend(&cp, wr_mas, &sib));