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.
*/
}
/*
- * 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
* 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)
{
* 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;
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;
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--);
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);
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);