]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree; rename mas_get/set_slot to mas_offset
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 28 Aug 2020 18:23:19 +0000 (14:23 -0400)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 5 Jan 2021 17:30:18 +0000 (12:30 -0500)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c

index 3e6a8722499574ac41ba9f9aa334fd7ac747018c..3f216d21dd8786f21a0faab8ec6ae287096dc1ba 100644 (file)
@@ -451,12 +451,12 @@ static inline int mas_get_alloc_req(const struct ma_state *mas)
        return (int)(((unsigned long)mas->alloc & 0x7F));
 }
 
-static inline int mas_get_slot(const struct ma_state *mas)
+static inline int mas_offset(const struct ma_state *mas)
 {
        return mas_get_alloc_req(mas);
 }
 
-static inline void mas_set_slot(struct ma_state *mas, int slot)
+static inline void mas_set_offset(struct ma_state *mas, int slot)
 {
        mas_set_alloc_req(mas, slot);
 }
@@ -800,7 +800,7 @@ static inline void mas_dup_state(struct ma_state *dst, struct ma_state *src)
        dst->node = src->node;
        dst->max = src->max;
        dst->min = src->min;
-       mas_set_slot(dst, mas_get_slot(src));
+       mas_set_offset(dst, mas_offset(src));
 }
 /*
  * mas_descend() - Descend into the slot stored in the ma_state.
@@ -809,12 +809,12 @@ static inline void mas_dup_state(struct ma_state *dst, struct ma_state *src)
  */
 static inline void mas_descend(struct ma_state *mas)
 {
-       unsigned char slot = mas_get_slot(mas);
+       unsigned char slot = mas_offset(mas);
 
        if (slot)
                mas->min = mas_get_safe_pivot(mas, slot - 1) + 1;
        mas->max = mas_get_safe_pivot(mas, slot);
-       mas->node = mas_get_rcu_slot(mas, mas_get_slot(mas));
+       mas->node = mas_get_rcu_slot(mas, mas_offset(mas));
 }
 
 static inline unsigned long ma_get_gap(const struct maple_node *mn,
@@ -893,6 +893,7 @@ no_parent:
 
        if (!max || min == ULONG_MAX) {
                if (mas->node == a_enode) {
+                       printk("Failed on node %p (%p)\n", mas_mn(mas), a_enode);
                        //FIXME: Restart and retry?
                        MT_BUG_ON(mas->tree, mas->node == a_enode);
                }
@@ -1074,7 +1075,7 @@ static inline struct maple_enode *mas_start(struct ma_state *mas)
                mas->node = MAS_NONE;
                mas->min = 0;
                mas->max = ULONG_MAX;
-               mas_set_slot(mas, 0);
+               mas_set_offset(mas, 0);
                if (!mas->tree->ma_root) // empty tree.
                        goto done;
 
@@ -1087,7 +1088,7 @@ static inline struct maple_enode *mas_start(struct ma_state *mas)
 
                        entry = mas->tree->ma_root;
                        mas->node = MAS_ROOT;
-                       mas_set_slot(mas, MAPLE_NODE_SLOTS);
+                       mas_set_offset(mas, MAPLE_NODE_SLOTS);
                } else {
                        mas->node = root;
                }
@@ -1283,7 +1284,7 @@ static inline void mas_update_gap(struct ma_state *mas)
 static inline unsigned long mas_first_node(struct ma_state *mas,
                unsigned long limit)
 {
-       int slot = mas_get_slot(mas) - 1;
+       int slot = mas_offset(mas) - 1;
        unsigned char count = mt_slot_count(mas->node);
        unsigned long pivot, min = mas->min;
 
@@ -1307,7 +1308,7 @@ static inline unsigned long mas_first_node(struct ma_state *mas,
                        mas->min = min;
                        mas->node = mn;
                }
-               mas_set_slot(mas, slot);
+               mas_set_offset(mas, slot);
                return pivot;
        }
 
@@ -1334,15 +1335,15 @@ static inline unsigned long mas_first_entry(struct ma_state *mas,
 
                if (mte_is_leaf(mas->node)) {
                        // Get the leaf slot.
-                       mas_set_slot(mas, 0);
+                       mas_set_offset(mas, 0);
                        mas_first_node(mas, limit);
                        if (mas_is_none(mas))
                                return limit;
                        return mas_get_safe_pivot(mas,
-                                       mas_get_slot(mas));
+                                       mas_offset(mas));
                }
 
-               mas_set_slot(mas, 0);
+               mas_set_offset(mas, 0);
        }
 }
 
@@ -1430,15 +1431,15 @@ static inline bool mas_new_child(struct ma_state *mas, struct ma_state *child)
        unsigned char slot, end = mt_slot_count(mas->node);
        struct maple_enode *entry;
 
-       for (slot = mas_get_slot(mas); slot < end; slot++) {
+       for (slot = mas_offset(mas); slot < end; slot++) {
                entry = mas_get_rcu_slot(mas, slot);
                if (!entry) // end of node data.
                        break;
 
                if (mte_parent(entry) == mas_mn(mas)) {
-                       mas_set_slot(mas, slot);
+                       mas_set_offset(mas, slot);
                        mas_dup_state(child, mas);
-                       mas_set_slot(mas, slot + 1);
+                       mas_set_offset(mas, slot + 1);
                        mas_descend(child);
                        return true;
                }
@@ -1628,8 +1629,8 @@ static inline void mas_descend_adopt(struct ma_state *mas)
 
        for (i = 0; i < 3; i++) {
                mas_dup_state(&list[i], mas);
-               mas_set_slot(&list[i], 0);
-               mas_set_slot(&next[i], 0);
+               mas_set_offset(&list[i], 0);
+               mas_set_offset(&next[i], 0);
        }
        mas_dup_state(&next[0], mas);
 
@@ -1654,7 +1655,7 @@ static inline void mas_descend_adopt(struct ma_state *mas)
                        next[n++].node = MAS_NONE;
 
                for (i = 0; i < 3; i++) { // descend.
-                       mas_set_slot(&next[i], 0);
+                       mas_set_offset(&next[i], 0);
                        mas_dup_state(&list[i], &next[i]);
                }
        }
@@ -1673,7 +1674,7 @@ static inline unsigned char mas_store_b_node(struct ma_state *mas,
                                    struct maple_big_node *b_node,
                                    void *entry)
 {
-       unsigned char slot = mas_get_slot(mas);
+       unsigned char slot = mas_offset(mas);
        unsigned char end = mas_data_end(mas);
        void *contents = mas_get_rcu_slot(mas, slot);
        unsigned char b_end = 0;
@@ -1752,7 +1753,7 @@ static inline bool mas_prev_sibling(struct ma_state *mas)
                return false;
 
        mas_ascend(mas);
-       mas_set_slot(mas, p_slot - 1);
+       mas_set_offset(mas, p_slot - 1);
        mas_descend(mas);
        return true;
 }
@@ -1780,7 +1781,7 @@ static inline bool mas_next_sibling(struct ma_state *mas)
                return false;
 
        mas_ascend(mas);
-       mas_set_slot(mas, p_slot + 1);
+       mas_set_offset(mas, p_slot + 1);
        mas_descend(mas);
        return true;
 }
@@ -1809,8 +1810,8 @@ static inline void mast_topiary(struct maple_subtree_state *mast)
        mas_node_walk(mast->orig_l, mte_node_type(mast->orig_l->node),
                      &range_min, &range_max);
        mast->orig_l->index = l_index;
-       l_slot = mas_get_slot(mast->orig_l);
-       r_slot = mas_get_slot(mast->orig_r);
+       l_slot = mas_offset(mast->orig_l);
+       r_slot = mas_offset(mast->orig_r);
        if (mast->orig_l->node == mast->orig_r->node) {
                for (slot = l_slot + 1; slot < r_slot; slot++)
                        mat_add(mast->destroy,
@@ -1857,7 +1858,7 @@ static inline void mast_rebalance_prev(struct maple_subtree_state *mast,
        mast->l->min = mast->orig_l->min;
        mast->orig_l->index = mast->orig_l->min;
        mast->bn->b_end = end + 1 + b_end;
-       mas_set_slot(mast->l, mas_get_slot(mast->l) + end + 1);
+       mas_set_offset(mast->l, mas_offset(mast->l) + end + 1);
 }
 static inline bool mast_sibling_rebalance_left(struct maple_subtree_state *mast)
 {
@@ -1911,7 +1912,7 @@ static inline bool mast_cousin_rebalance_right(struct maple_subtree_state *mast)
        struct maple_enode *old_l = mast->orig_l->node;
        struct maple_enode *old_r = mast->orig_r->node;
 
-       mas_set_slot(mast->orig_r,
+       mas_set_offset(mast->orig_r,
                     mte_parent_slot(mast->orig_r->node));
        mas_next_node(mast->orig_r, ULONG_MAX);
        if (!mas_is_none(mast->orig_r)) {
@@ -1928,7 +1929,7 @@ static inline bool mast_cousin_rebalance_right(struct maple_subtree_state *mast)
                return false;
        }
 
-       mas_set_slot(mast->orig_l, 0);
+       mas_set_offset(mast->orig_l, 0);
        mast_rebalance_prev(mast, old_l);
        return true;
 }
@@ -1953,7 +1954,7 @@ mast_ascend_free(struct maple_subtree_state *mast)
        if (left != right)
                mat_add(mast->free, right);
 
-       mas_set_slot(mast->orig_r, 0);
+       mas_set_offset(mast->orig_r, 0);
        mast->orig_r->index = mast->r->max;
        /* last should be larger than or equal to index */
        if (mast->orig_r->last < mast->orig_r->index)
@@ -1964,10 +1965,10 @@ mast_ascend_free(struct maple_subtree_state *mast)
        if (!mas_node_walk(mast->orig_r,
                           mte_node_type(mast->orig_r->node),
                           &range_min, &range_max)) {
-               mas_set_slot(mast->orig_r, mas_data_end(mast->orig_r) + 1);
+               mas_set_offset(mast->orig_r, mas_data_end(mast->orig_r) + 1);
        }
        /* Set up the left side of things */
-       mas_set_slot(mast->orig_l, 0);
+       mas_set_offset(mast->orig_l, 0);
        mast->orig_l->index = mast->l->min;
        mas_node_walk(mast->orig_l, mte_node_type(mast->orig_l->node),
                      &range_min, &range_max);
@@ -2122,7 +2123,7 @@ static inline void mast_set_split_parents(struct maple_subtree_state *mast,
        if (middle)
                r = middle;
 
-       slot = mas_get_slot(mast->l);
+       slot = mas_offset(mast->l);
 
        mte_mid_split_check(&l, &r, right, slot, &split, mid_split);
        // Set left parent.
@@ -2219,7 +2220,7 @@ static inline void mast_cp_to_nodes(struct maple_subtree_state *mast,
  */
 static inline void mast_combine_cp_left(struct maple_subtree_state *mast)
 {
-       unsigned char l_slot = mas_get_slot(mast->orig_l);
+       unsigned char l_slot = mas_offset(mast->orig_l);
 
        if (!l_slot)
                return;
@@ -2235,7 +2236,7 @@ static inline void mast_combine_cp_right(struct maple_subtree_state *mast)
        if (mast->bn->pivot[mast->bn->b_end - 1] >= mast->orig_r->max)
                return;
 
-       mas_mab_cp(mast->orig_r, mas_get_slot(mast->orig_r) + 1,
+       mas_mab_cp(mast->orig_r, mas_offset(mast->orig_r) + 1,
                   mas_data_end(mast->orig_r), mast->bn, mast->bn->b_end);
        mast->orig_r->last = mast->orig_r->max;
 }
@@ -2318,7 +2319,7 @@ static inline int mas_spanning_rebalance(struct ma_state *mas,
 
                mast_ascend_free(mast);
                mast_combine_cp_left(mast);
-               mas_set_slot(&l_mas, mast->bn->b_end);
+               mas_set_offset(&l_mas, mast->bn->b_end);
                mab_set_b_end(mast->bn, &l_mas, left);
                mab_set_b_end(mast->bn, &m_mas, middle);
                mab_set_b_end(mast->bn, &r_mas, right);
@@ -2444,8 +2445,8 @@ static inline bool mas_split_final_node(struct maple_subtree_state *mast,
         * Big_node should just fit in a single node.
         */
        ancestor = mas_new_ma_node(mas, mast->bn);
-       mte_set_parent(mast->l->node, ancestor, mas_get_slot(mast->l));
-       mte_set_parent(mast->r->node, ancestor, mas_get_slot(mast->r));
+       mte_set_parent(mast->l->node, ancestor, mas_offset(mast->l));
+       mte_set_parent(mast->r->node, ancestor, mas_offset(mast->r));
        mte_to_node(ancestor)->parent = mas_mn(mas)->parent;
        // New root requires a new height.
        if (mas->full_cnt >= mas_height) {
@@ -2472,16 +2473,16 @@ static inline void mast_split_fill_bnode(struct maple_subtree_state *mast,
        } else {
                mas_ascend(mas);
                mat_add(mast->free, old);
-               mas_set_slot(mas, mte_parent_slot(mas->node));
+               mas_set_offset(mas, mte_parent_slot(mas->node));
        }
 
        mast->bn->min = mas->min;
-       if (cp && mas_get_slot(mast->l))
-               mas_mab_cp(mas, 0, mas_get_slot(mast->l) - 1, mast->bn, 0);
+       if (cp && mas_offset(mast->l))
+               mas_mab_cp(mas, 0, mas_offset(mast->l) - 1, mast->bn, 0);
 
        split = mast->bn->b_end;
        mab_set_b_end(mast->bn, mast->l, mast->l->node);
-       mas_set_slot(mast->r, mast->bn->b_end);
+       mas_set_offset(mast->r, mast->bn->b_end);
        mab_set_b_end(mast->bn, mast->r, mast->r->node);
        if (cp)
                mas_mab_cp(mas, split + skip, mt_slot_count(mas->node) - 1,
@@ -2500,11 +2501,11 @@ static inline void mast_split_data(struct maple_subtree_state *mast,
        mab_mas_cp(mast->bn, 0, split, mast->l);
        mte_set_pivot(mast->r->node, 0, mast->r->max);
        mab_mas_cp(mast->bn, split + 1, mast->bn->b_end, mast->r);
-       mas_set_slot(mast->l, mte_parent_slot(mas->node));
+       mas_set_offset(mast->l, mte_parent_slot(mas->node));
        mast->l->max = mast->bn->pivot[split];
        mast->r->min = mast->l->max + 1;
        if (!mte_is_leaf(mas->node)) {
-               p_slot = mas_get_slot(mast->orig_l);
+               p_slot = mas_offset(mast->orig_l);
                mas_set_split_parent(mast->orig_l, mast->l->node,
                                     mast->r->node, &p_slot, split);
                mas_set_split_parent(mast->orig_r, mast->l->node,
@@ -2568,7 +2569,7 @@ static inline bool mas_push_data(struct ma_state *mas,
        split = mab_no_null_split(mast->bn, split, mt_slots[mast->bn->type]);
        // Update parent slot for split calculation.
        if (left)
-               mas_set_slot(mast->orig_l, mas_get_slot(mast->orig_l) + end + 1);
+               mas_set_offset(mast->orig_l, mas_offset(mast->orig_l) + end + 1);
 
        mast_split_data(mast, mas, split);
        mast_split_fill_bnode(mast, mas, 2);
@@ -2808,7 +2809,7 @@ static inline bool mas_node_walk(struct ma_state *mas, enum maple_type type,
 
        switch (type) {
        default:
-               for (i = mas_get_slot(mas); i < mt_slots[type]; i++) {
+               for (i = mas_offset(mas); i < mt_slots[type]; i++) {
                        pivot = _mas_get_safe_pivot(mas, i, type);
 
                        if (!pivot && i) {
@@ -2838,7 +2839,7 @@ static inline bool mas_node_walk(struct ma_state *mas, enum maple_type type,
                *range_min = min;
                *range_max = pivot;
        }
-       mas_set_slot(mas, i);
+       mas_set_offset(mas, i);
        return ret;
 }
 static inline void mas_cnt_full(struct ma_state *mas)
@@ -2900,7 +2901,7 @@ static inline bool mas_wr_walk(struct ma_state *mas, unsigned long *range_min,
 
 
 
-               next = mas_get_rcu_slot(mas, mas_get_slot(mas));
+               next = mas_get_rcu_slot(mas, mas_offset(mas));
 
                // Traverse.
                mas->max = *range_max;
@@ -2909,7 +2910,7 @@ static inline bool mas_wr_walk(struct ma_state *mas, unsigned long *range_min,
                        return false;
 
                mas->node = next;
-               mas_set_slot(mas, 0);
+               mas_set_offset(mas, 0);
        }
        return ret;
 }
@@ -2917,8 +2918,8 @@ static inline bool mas_wr_walk(struct ma_state *mas, unsigned long *range_min,
 static inline unsigned char mas_extend_null(struct ma_state *l_mas,
                                            struct ma_state *r_mas)
 {
-       unsigned char l_slot = mas_get_slot(l_mas);
-       unsigned char r_slot = mas_get_slot(r_mas);
+       unsigned char l_slot = mas_offset(l_mas);
+       unsigned char r_slot = mas_offset(r_mas);
        unsigned char cp_r_slot = r_slot;
        void *content = mas_get_rcu_slot(l_mas, l_slot);
        unsigned long range_max = mas_get_safe_pivot(r_mas, r_slot);
@@ -2936,7 +2937,7 @@ static inline unsigned char mas_extend_null(struct ma_state *l_mas,
                        l_mas->index = mas_get_safe_pivot(l_mas, l_slot - 2) + 1;
                else
                        l_mas->index = l_mas->min;
-               mas_set_slot(l_mas, l_slot - 1);
+               mas_set_offset(l_mas, l_slot - 1);
        }
 
        if (!mas_get_rcu_slot(r_mas, r_slot)) {
@@ -2955,7 +2956,7 @@ static inline unsigned char mas_extend_null(struct ma_state *l_mas,
                r_mas->last = r_mas->max;
 
        if (l_mas != r_mas)
-               mas_set_slot(r_mas, cp_r_slot);
+               mas_set_offset(r_mas, cp_r_slot);
 
        return r_slot;
 }
@@ -2985,7 +2986,7 @@ static inline bool __mas_walk(struct ma_state *mas, unsigned long *range_min,
                if (ma_is_leaf(type)) // Leaf.
                        return true;
 
-               next = mas_get_rcu_slot(mas, mas_get_slot(mas));
+               next = mas_get_rcu_slot(mas, mas_offset(mas));
 
                if (unlikely(mt_is_empty(next)))
                        return false;
@@ -2996,7 +2997,7 @@ static inline bool __mas_walk(struct ma_state *mas, unsigned long *range_min,
                mas->min = *range_min;
 
                mas->node = next;
-               mas_set_slot(mas, 0);
+               mas_set_offset(mas, 0);
        }
        return ret;
 }
@@ -3056,14 +3057,14 @@ static inline int mas_spanning_store(struct ma_state *mas, void *entry)
                r_mas.last++;
 
        r_mas.index = r_mas.last;
-       mas_set_slot(&r_mas, 0);
+       mas_set_offset(&r_mas, 0);
        __mas_walk(&r_mas, &range_min, &range_max);
        r_mas.last = r_mas.index = mas->last;
 
        // Set up left side.
        mas_dup_state(&l_mas, mas);
        l_mas.depth = mas->depth;
-       mas_set_slot(&l_mas, 0);
+       mas_set_offset(&l_mas, 0);
        __mas_walk(&l_mas, &range_min, &range_max);
 
        MT_BUG_ON(mas->tree, l_mas.depth != r_mas.depth);
@@ -3072,14 +3073,14 @@ static inline int mas_spanning_store(struct ma_state *mas, void *entry)
                mas_extend_null(&l_mas, &r_mas);
                mas->index = l_mas.index;
                mas->last = l_mas.last = r_mas.index = r_mas.last;
-               mas_set_slot(mas, mas_get_slot(&l_mas));
+               mas_set_offset(mas, mas_offset(&l_mas));
        }
 
 
        // Copy l_mas and store the value in b_node.
        b_node.b_end = mas_store_b_node(&l_mas, &b_node, entry);
        // Copy r_mas into b_node.
-       mas_mab_cp(&r_mas, mas_get_slot(&r_mas), mas_data_end(&r_mas), &b_node,
+       mas_mab_cp(&r_mas, mas_offset(&r_mas), mas_data_end(&r_mas), &b_node,
                   b_node.b_end + 1);
        // Stop spanning searches by searching for just index.
        l_mas.index = l_mas.last = mas->index;
@@ -3148,7 +3149,7 @@ static inline void *_mas_store(struct ma_state *mas, void *entry, bool overwrite
 
        /* At this point, we are at the leaf node that needs to be altered. */
        /* Calculate needed space */
-       slot = mas_get_slot(mas);
+       slot = mas_offset(mas);
        slot_cnt = mt_slot_count(mas->node);
        content = mas_get_rcu_slot(mas, slot);
        if (!overwrite && ((mas->last > r_max) || content)) {
@@ -3158,11 +3159,11 @@ static inline void *_mas_store(struct ma_state *mas, void *entry, bool overwrite
 
        if (!entry) {
                mas_extend_null(mas, mas);
-               slot = mas_get_slot(mas);
+               slot = mas_offset(mas);
        }
 
        memset(&b_node, 0, sizeof(struct maple_big_node));
-       mas_set_slot(mas, slot);
+       mas_set_offset(mas, slot);
        b_node.b_end = mas_store_b_node(mas, &b_node, entry);
        b_node.min = mas->min;
        b_node.type = mte_node_type(mas->node);
@@ -3207,12 +3208,12 @@ void *mas_store(struct ma_state *mas, void *entry)
 static inline int mas_dead_node(struct ma_state *mas, unsigned long index);
 /*
  * mas_prev_node() - Find the prev non-null entry at the same level in the
- * tree.  The prev value will be mas->node[mas_get_slot(mas)] or MAS_NONE.
+ * tree.  The prev value will be mas->node[mas_offset(mas)] or MAS_NONE.
  */
 static inline void mas_prev_node(struct ma_state *mas, unsigned long limit)
 {
        unsigned long pivot, start_piv, last_pivot, min;
-       int slot = mas_get_slot(mas);
+       int slot = mas_offset(mas);
        struct maple_enode *mn;
        int level;
 
@@ -3250,7 +3251,7 @@ restart_prev_node:
                                continue;
 
                        if (level == 1) {
-                               mas_set_slot(mas, slot);
+                               mas_set_offset(mas, slot);
                                mas->node = mn;
                                mas->max = pivot;
                                mas->min = min;
@@ -3277,7 +3278,7 @@ no_entry:
 }
 /*
  * Find the next non-null entry at the same level in the tree.  The next value
- * will be mas->node[mas_get_slot(mas)] or MAS_NONE.
+ * will be mas->node[mas_offset(mas)] or MAS_NONE.
  *
  *
  * Node: Not safe to call with mas->node == root
@@ -3301,7 +3302,7 @@ restart_next_node:
                        goto no_entry;
 
                mn = mas->node;
-               slot = mas_get_slot(mas);
+               slot = mas_offset(mas);
                start_piv = mas_get_safe_pivot(mas, slot);
                level++;
                mas_ascend(mas);
@@ -3330,7 +3331,7 @@ restart_next_node:
                        mas->max = pivot;
 
                        if (level == 1) {
-                               mas_set_slot(mas, slot);
+                               mas_set_offset(mas, slot);
                                mas->node = mn;
                                if (mas_dead_node(mas, start_piv))
                                        goto restart_next_node;
@@ -3346,7 +3347,7 @@ restart_next_node:
 
                if (mte_is_root(mas->node))
                        goto no_entry;
-               mas_set_slot(mas, mte_parent_slot(mas->node));
+               mas_set_offset(mas, mte_parent_slot(mas->node));
        }
 
 no_entry:
@@ -3362,7 +3363,7 @@ static inline bool mas_prev_nentry(struct ma_state *mas, unsigned long limit,
                unsigned long *max)
 {
        unsigned long pivot = mas->max;
-       unsigned char slot = mas_get_slot(mas);
+       unsigned char slot = mas_offset(mas);
        void *entry;
 
        if (!slot)
@@ -3383,7 +3384,7 @@ static inline bool mas_prev_nentry(struct ma_state *mas, unsigned long limit,
                return false;
 
        *max = pivot;
-       mas_set_slot(mas, slot);
+       mas_set_offset(mas, slot);
        return true;
 }
 /*
@@ -3396,7 +3397,7 @@ static inline bool mas_next_nentry(struct ma_state *mas, unsigned long max,
 {
        unsigned long pivot = mas->min;
        unsigned long r_start = mas->min;
-       unsigned char slot = mas_get_slot(mas);
+       unsigned char slot = mas_offset(mas);
        unsigned char count = mt_slot_count(mas->node);
        void *entry;
 
@@ -3436,7 +3437,7 @@ no_entry:
 found:
        mas->last = pivot;
        *range_start = r_start;
-       mas_set_slot(mas, slot);
+       mas_set_offset(mas, slot);
        return true;
 }
 /*
@@ -3459,7 +3460,7 @@ static inline void *mas_last_entry(struct ma_state *mas,
        prev_min = mas->min;
        prev_max = mas->max;
        while (range_start < limit) {
-               mas_set_slot(mas, slot);
+               mas_set_offset(mas, slot);
                if (!mas_next_nentry(mas, limit, &range_start)) {
                        entry = mas_get_rcu_slot(mas, slot - 1);
                        if (mte_is_leaf(mas->node)) {
@@ -3473,7 +3474,7 @@ static inline void *mas_last_entry(struct ma_state *mas,
                        mas->node = entry;
                        slot = 0;
                } else {
-                       slot = mas_get_slot(mas) + 1;
+                       slot = mas_offset(mas) + 1;
                        prev_min = prev_max + 1;
                        if (range_start > prev_min)
                                prev_min = range_start;
@@ -3497,9 +3498,9 @@ static inline void *__mas_next(struct ma_state *mas, unsigned long limit,
 {
        void *entry = NULL;
        unsigned long index = mas->index;
-       unsigned char slot = mas_get_slot(mas);
+       unsigned char slot = mas_offset(mas);
 
-       mas_set_slot(mas, slot + 1);
+       mas_set_offset(mas, slot + 1);
 
 retry:
        *range_start = mas->last + 1;
@@ -3508,11 +3509,11 @@ retry:
                unsigned char p_slot = 0;
                struct maple_enode *last_node = mas->node;
 
-               slot = mas_get_slot(mas);
+               slot = mas_offset(mas);
                if (slot > mt_slot_count(mas->node))
                        goto next_node;
 
-               if (!mte_is_leaf(mas->node) || !mas_get_slot(mas)) {
+               if (!mte_is_leaf(mas->node) || !mas_offset(mas)) {
                        *range_start = mas_first_entry(mas, limit);
                        if (mas_is_none(mas)) {
                                mas->node = last_node;
@@ -3528,15 +3529,15 @@ retry:
 
 next_node:
                p_slot = mte_parent_slot(mas->node);
-               mas_set_slot(mas, p_slot);
+               mas_set_offset(mas, p_slot);
                mas_next_node(mas, limit);
-               mas_set_slot(mas, 0);
+               mas_set_offset(mas, 0);
        }
 
        if (mas_is_none(mas))
                return NULL;
 
-       entry = mas_get_rcu_slot(mas, mas_get_slot(mas));
+       entry = mas_get_rcu_slot(mas, mas_offset(mas));
        if (mas_dead_node(mas, index))
                goto retry;
 
@@ -3558,7 +3559,7 @@ static inline void *_mas_prev(struct ma_state *mas, unsigned long limit)
                        break;
 
                mas_prev_node(mas, limit);
-               mas_set_slot(mas, mt_slot_count(mas->node));
+               mas_set_offset(mas, mt_slot_count(mas->node));
        }
 
        if (mas_is_none(mas)) {
@@ -3567,9 +3568,9 @@ static inline void *_mas_prev(struct ma_state *mas, unsigned long limit)
        }
 
        mas->last = max;
-       slot = mas_get_slot(mas);
+       slot = mas_offset(mas);
        mas->index = mas_get_safe_lower_bound(mas, slot);
-       return mas_get_rcu_slot(mas, mas_get_slot(mas));
+       return mas_get_rcu_slot(mas, mas_offset(mas));
 }
 
 /*
@@ -3608,7 +3609,7 @@ EXPORT_SYMBOL_GPL(mas_prev);
 static inline bool _mas_rev_awalk(struct ma_state *mas, unsigned long size)
 {
        enum maple_type type = mte_node_type(mas->node);
-       unsigned char slot = mas_get_slot(mas);
+       unsigned char slot = mas_offset(mas);
        unsigned long max, min = mas->min;
        unsigned long gap = 0;
        bool found = false;
@@ -3678,13 +3679,13 @@ next_slot:
                slot = _mas_data_end(mas, mte_node_type(next), &max);
        }
 
-       mas_set_slot(mas, slot);
+       mas_set_offset(mas, slot);
        return found;
 ascend:
        if (mte_is_root(mas->node))
                mas_set_err(mas, -EBUSY);
 
-       mas_set_slot(mas, slot);
+       mas_set_offset(mas, slot);
        return found;
 }
 
@@ -3697,7 +3698,7 @@ static inline bool _mas_awalk(struct ma_state *mas, unsigned long size)
 
        switch (type) {
        default:
-               slot = mas_get_slot(mas);
+               slot = mas_offset(mas);
                fallthrough;
        case maple_leaf_64:
                min = mas_get_safe_lower_bound(mas, slot);
@@ -3749,7 +3750,7 @@ next_slot:
        if (mte_is_root(mas->node))
                found = true;
 
-       mas_set_slot(mas, slot);
+       mas_set_offset(mas, slot);
        return found;
 }
 
@@ -3768,14 +3769,14 @@ static inline bool _mas_range_walk(struct ma_state *mas,
                return true;
 
        if (mas_is_none(mas)) {
-               mas_set_slot(mas, MAPLE_NODE_SLOTS);
+               mas_set_offset(mas, MAPLE_NODE_SLOTS);
                return false;
        }
 
        if (mas_is_ptr(mas))
                return true;
 
-       mas_set_slot(mas, 0);
+       mas_set_offset(mas, 0);
        return __mas_walk(mas, range_min, range_max);
 }
 
@@ -3854,7 +3855,7 @@ static inline bool mas_rewind_node(struct ma_state *mas)
 
        do {
                if (mte_is_root(mas->node)) {
-                       slot = mas_get_slot(mas);
+                       slot = mas_offset(mas);
                        if (!slot) {
                                mas_set_err(mas, -EBUSY);
                                return false;
@@ -3865,7 +3866,7 @@ static inline bool mas_rewind_node(struct ma_state *mas)
                }
        } while (!slot);
 
-       mas_set_slot(mas, --slot);
+       mas_set_offset(mas, --slot);
        return true;
 }
 static inline void mas_rev_awalk(struct ma_state *mas, unsigned long size)
@@ -3874,7 +3875,7 @@ static inline void mas_rev_awalk(struct ma_state *mas, unsigned long size)
 
        mas_start(mas);
        if (mas_is_none(mas)) {
-               mas_set_slot(mas, MAPLE_NODE_SLOTS);
+               mas_set_offset(mas, MAPLE_NODE_SLOTS);
                return;
        }
 
@@ -3883,7 +3884,7 @@ static inline void mas_rev_awalk(struct ma_state *mas, unsigned long size)
        if (mas_is_err(mas))
                return;
 
-       mas_set_slot(mas, mas_data_end(mas));
+       mas_set_offset(mas, mas_data_end(mas));
 
 
        /* There are 4 options:
@@ -3906,7 +3907,7 @@ static inline bool mas_skip_node(struct ma_state *mas)
 
        do {
                if (mte_is_root(mas->node)) {
-                       slot = mas_get_slot(mas);
+                       slot = mas_offset(mas);
                        if (slot > mt_slot_count(mas->node) - 1) {
                                mas_set_err(mas, -EBUSY);
                                return false;
@@ -3917,7 +3918,7 @@ static inline bool mas_skip_node(struct ma_state *mas)
                }
        } while (slot > mt_slot_count(mas->node) - 1);
 
-       mas_set_slot(mas, ++slot);
+       mas_set_offset(mas, ++slot);
        if (slot > 0)
                mas->min = mte_get_pivot(mas->node, slot - 1) + 1;
 
@@ -3971,7 +3972,7 @@ static int mas_fill_gap(struct ma_state *mas, void *entry, unsigned char slot,
        mas->max = mas_get_safe_pivot(mas, pslot);
        mas->min = mas_get_safe_lower_bound(mas, pslot);
        mas->node = mn;
-       mas_set_slot(mas, slot);
+       mas_set_offset(mas, slot);
        _mas_store(mas, entry, false);
        return 0;
 }
@@ -3979,7 +3980,7 @@ static int mas_fill_gap(struct ma_state *mas, void *entry, unsigned char slot,
 void mas_set_fwd_index(struct ma_state *mas, unsigned long size)
 {
        unsigned long min = mas->min;
-       unsigned char slot = mas_get_slot(mas);
+       unsigned char slot = mas_offset(mas);
        // At this point, mas->node points to the right node and we have a
        // slot that has a sufficient gap.
        if (slot)
@@ -4056,7 +4057,7 @@ static inline int _mas_get_empty_area(struct ma_state *mas,
        if (mas_is_err(mas))
                return xa_err(mas->node);
 
-       if (mas_get_slot(mas) == MAPLE_NODE_SLOTS)
+       if (mas_offset(mas) == MAPLE_NODE_SLOTS)
                return -EBUSY;
 
        if (forward)
@@ -4107,7 +4108,7 @@ static inline int mas_alloc(struct ma_state *mas, void *entry,
        if (mas_is_err(mas))
                return xa_err(mas->node);
 
-       slot = mas_get_slot(mas);
+       slot = mas_offset(mas);
        if (slot == MAPLE_NODE_SLOTS)
                goto no_gap;
 
@@ -4148,7 +4149,7 @@ static inline int mas_rev_alloc(struct ma_state *mas, unsigned long min,
        if (mas_is_err(mas))
                return xa_err(mas->node);
 
-       slot = mas_get_slot(mas);
+       slot = mas_offset(mas);
        if (slot == MAPLE_NODE_SLOTS)
                goto no_gap;
 
@@ -4180,7 +4181,7 @@ retry:
                if (mas_is_ptr(mas) && mas->last == 0)
                        return mte_safe_root(mas->tree->ma_root);
 
-               slot = mas_get_slot(mas);
+               slot = mas_offset(mas);
                if (slot >= MAPLE_NODE_SLOTS)
                        return NULL;
 
@@ -4279,7 +4280,7 @@ void *_mt_find(struct maple_tree *mt, unsigned long *index, unsigned long max,
 
        rcu_read_lock();
        leaf = _mas_range_walk(&mas, &range_start, &range_end);
-       slot = mas_get_slot(&mas);
+       slot = mas_offset(&mas);
        if (leaf == true && slot != MAPLE_NODE_SLOTS)
                entry = mas_get_rcu_slot(&mas, slot);
 
@@ -4749,7 +4750,7 @@ int mtree_alloc_range(struct maple_tree *mt, unsigned long *startp,
 
        mtree_lock(mas.tree);
 retry:
-       mas_set_slot(&mas, 0);
+       mas_set_offset(&mas, 0);
        mas.index = min;
        mas.last = max - size;
        ret = mas_alloc(&mas, entry, size, startp);
@@ -5222,7 +5223,7 @@ static inline void mas_dfs_postorder(struct ma_state *mas, unsigned long max)
        struct maple_enode *p = MAS_NONE, *mn = mas->node;
        unsigned long p_min, p_max;
 
-       mas_set_slot(mas, mte_parent_slot(mas->node));
+       mas_set_offset(mas, mte_parent_slot(mas->node));
        mas_next_node(mas, max);
        if (!mas_is_none(mas))
                return;