unsigned long min, unsigned long max, unsigned int depth,
enum mt_dump_format format);
+static inline void spanning_data_calc(struct maple_copy *cp,
+ struct ma_state *mas, struct maple_subtree_state *mast,
+ struct ma_wr_state *l_wr_mas, struct ma_wr_state *r_wr_mas,
+ struct ma_state *sib)
+{
+ /* data from left + new entry */
+ cp->data = mast->orig_l->offset + 1;
+ printk("data size is off %u + 1\n", mast->orig_l->offset);
+ printk("write is now %lx - %lx => %p\n", mas->index, mas->last, l_wr_mas->entry);
+ /* new entry will overwrite one part of left */
+ if (l_wr_mas->r_min == mas->index) {
+ printk("min doesn't split, subtrack one\n");
+ cp->data--;
+ } else {
+ printk("min splits start %lx vs %lx\n", l_wr_mas->r_min, mas->index);
+ }
+
+ printk("%p data + 1 = %u\n", mast->orig_l->node, cp->data);
+
+ /* Data from right (offset to end) + 1 for zero, +1 for splitting */
+ cp->data += mast->orig_r->end - mast->orig_r->offset + 2;
+ printk("end %u - off %u + 1\n", mast->orig_r->end, mast->orig_r->offset);
+ /* new entry splits the insert location */
+ printk("end piv %lx vs last %lx\n", r_wr_mas->r_max, mas->last);
+ if (r_wr_mas->r_max == mas->last) {
+ printk("cp->data--\n");
+ cp->data--;
+ }
+
+ printk("%p data = %u\n", mast->orig_r->node, cp->data);
+
+ if (((mast->orig_l->min != 0) || (mast->orig_r->max != ULONG_MAX)) &&
+ (cp->data < mt_min_slots[l_wr_mas->type])) {
+ mas_spanning_move(mast, sib);
+ cp->data += sib->end + 1;
+ printk("%p data = %u\n", sib->node, cp->data);
+ } else {
+ sib->end = 0;
+ }
+
+}
+
static void spanning_data_write(struct maple_copy *cp, struct ma_state *mas)
{
struct maple_node *dst, *src;
*/
mt_dump(mas->tree, mt_dump_hex);
- /* data from left + new entry */
- cp.data = mast->orig_l->offset + 1;
- printk("data size is off %u + 1\n", mast->orig_l->offset);
- printk("write is now %lx - %lx => %p\n", mas->index, mas->last, l_wr_mas->entry);
- /* new entry will overwrite one part of left */
- if (l_wr_mas->r_min == mas->index) {
- printk("min doesn't split, subtrack one\n");
- cp.data--;
- } else {
- printk("min splits start %lx vs %lx\n", l_wr_mas->r_min, mas->index);
- }
-
- printk("%p data + 1 = %u\n", mast->orig_l->node, cp.data);
-
- /* Data from right (offset to end) + 1 for zero, +1 for splitting */
- cp.data += mast->orig_r->end - mast->orig_r->offset + 2;
- printk("end %u - off %u + 1\n", mast->orig_r->end, mast->orig_r->offset);
- /* new entry splits the insert location */
- printk("end piv %lx vs last %lx\n", r_wr_mas->r_max, mas->last);
- if (r_wr_mas->r_max == mas->last) {
- printk("cp.data--\n");
- cp.data--;
- }
-
- printk("%p data = %u\n", mast->orig_r->node, cp.data);
+ spanning_data_calc(&cp, mas, mast, l_wr_mas, r_wr_mas, &sib);
mt = l_wr_mas->type;
- if (((mast->orig_l->min != 0) || (mast->orig_r->max != ULONG_MAX)) &&
- (cp.data < mt_min_slots[mt])) {
- mas_spanning_move(mast, &sib);
- cp.data += sib.end + 1;
- printk("%p data = %u\n", sib.node, cp.data);
- } else {
- sib.end = 0;
- }
-
cp.d_count = 0;
/* Calc split here */
if (cp.data < mt_slots[mt]) {