]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Revert "maple_tree: Add parent slot to maple state." maple
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 18 Dec 2018 18:44:20 +0000 (13:44 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 18 Dec 2018 18:44:20 +0000 (13:44 -0500)
A parent slot may be useful for the final slot in a node, but that work
has been put on hold for now.

This reverts commit 4c0d859ef03a19feab889b0cf6a9562a65d2818e.

include/linux/maple_tree.h
lib/maple_tree.c

index b2e5300356f67d290c8ab3d014ab827f84fd488d..7ba0432c8c4019d120abcee9d0ae413564994f46 100644 (file)
@@ -128,7 +128,6 @@ struct maple_state {
        unsigned long min;      /* The smallest index to be found in %node */
        unsigned long max;      /* The largest index to be found in %node */
        unsigned long slot_idx; /* The slot index from %node */
-       unsigned long pslot_idx; /* The slot index from the parent %node */
        struct maple_node *alloc;       /* Allocated for this operation */
        short flags;            /* Different stuff */
 };
index 85470e348109c97d0ea3dfa8fabbf7df3a01ff01..7b272ebdab596f5c63c567a8a4853d9fb083543e 100644 (file)
@@ -206,7 +206,6 @@ static void *_maple_walk_4(struct maple_state *ms)
 {
        struct maple_node_4 *mn4 = &ms->node->map4;
 
-       ms->pslot_idx = ms->slot_idx;
        ms->slot_idx = ms->index - ms->min;
        return rcu_dereference(mn4->slot[ms->slot_idx]);
 }
@@ -223,7 +222,6 @@ static void *_maple_walk_64(struct maple_state *ms, unsigned long val)
                        break;
        } while (i++ < MAPLE_NODE64_MAX_SLOT - 1);
 
-       ms->pslot_idx = ms->slot_idx;
        ms->slot_idx = i;
        return rcu_dereference(mn64->slot[i]);
 }
@@ -391,7 +389,6 @@ static void _maple_root_expand(struct maple_state *ms)
        if (r_entry != NULL) {
                RCU_INIT_POINTER(mn->map64.slot[0], r_entry);
                mn->map64.pivot[0] = 1;
-               ms->pslot_idx = 0;
                ms->slot_idx = 1;
        }
 
@@ -542,15 +539,18 @@ void maple_link_node(struct maple_state *ms,
 
                left->parent = full->parent;
                right->parent = full->parent;
+               /* Get the slot_idx to overwrite in the parent */
+               ms->node = full->parent;
+               _maple_walk_64(ms, ms->index);
                /* Shift the data over */
-               maple_shift_64(target, ms->pslot_idx, 1);
+               maple_shift_64(target, ms->slot_idx, 1);
                /* Overwrite the duplicate slot data with the new right node */
-               target->slot[ms->pslot_idx + 1] = ma_mk_node(right);
+               target->slot[ms->slot_idx + 1] = ma_mk_node(right);
                /* Overwrite the first pivot with the new value.  This is fine
                 * as the current slot has valid entries for this pivot */
-               target->pivot[ms->pslot_idx] = left64->pivot[l_end];
+               target->pivot[ms->slot_idx] = left64->pivot[l_end];
                /* Set the first slot to the node with less pivots */
-               target->slot[ms->pslot_idx] = ma_mk_node(left);
+               target->slot[ms->slot_idx] = ma_mk_node(left);
                /* Update the new nodes children's parent setting */
                maple_update_parent(left);
                maple_update_parent(right);