]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: remove _mas_data_end, only used in a few places
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 4 Sep 2020 16:12:08 +0000 (12:12 -0400)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 30 Oct 2020 19:11:04 +0000 (15:11 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c

index 9baa67d7b408153481787586cdf39b933e1b555f..c3d8cee4a3b3fbc092ddcc2f62d1fa8676de94a4 100644 (file)
@@ -1119,42 +1119,32 @@ done:
 }
 
 /*
- * mas_data_end() - Find the end of the data (slot).  Sets the value of the
- * last pivot to @last_piv.
+ * mas_data_end() - Find the end of the data (slot).
  *
  * @mas - the maple state
  * @type - the type of maple node
- * @last_piv - the final pivot in this node.
  */
-static inline unsigned char _mas_data_end(const struct ma_state *mas,
-               const enum maple_type type, unsigned long *last_piv)
+static inline unsigned char mas_data_end(const struct ma_state *mas)
+
 {
        int slot = 0;
-       unsigned long piv = mas->min, prev_piv = mas->min;
+       enum maple_type type = mte_node_type(mas->node);
+       unsigned long piv = mas->min;
 
-       for (; slot < mt_slot_count(mas->node); slot++) {
+       for (; slot < mt_slots[type]; slot++) {
                piv = _mas_get_safe_pivot(mas, slot, type);
                if (piv >= mas->max)
                        break;
 
                if (!piv && slot) {
-                       piv = prev_piv;
                        slot--;
                        break;
                }
-               prev_piv = piv;
        }
 
-       *last_piv = piv;
        return slot;
 }
 
-static inline unsigned char mas_data_end(const struct ma_state *mas)
-{
-       unsigned long l;
-
-       return _mas_data_end(mas, mte_node_type(mas->node), &l);
-}
 /*
  * mas_leaf_max_gap() - Returns the largest gap in a leaf node
  *
@@ -3259,7 +3249,7 @@ static inline int mas_dead_node(struct ma_state *mas, unsigned long index);
  */
 static inline void mas_prev_node(struct ma_state *mas, unsigned long limit)
 {
-       unsigned long pivot, start_piv, last_pivot, min;
+       unsigned long pivot, start_piv, min;
        int slot = mas_offset(mas);
        struct maple_enode *mn;
        int level;
@@ -3311,8 +3301,7 @@ restart_prev_node:
                        mas->node = mn;
                        mas->max = pivot;
                        mas->min = min;
-                       slot = _mas_data_end(mas, mte_node_type(mn),
-                                            &last_pivot) + 1;
+                       slot = mas_data_end(mas) + 1;
                } while (slot-- > 0);
 
 ascend:
@@ -3725,7 +3714,8 @@ next_slot:
                        goto ascend;
 
                mas->node = next;
-               slot = _mas_data_end(mas, mte_node_type(next), &max);
+               slot = mas_data_end(mas);
+               max = mas_get_safe_pivot(mas, slot);
        }
 
        mas_set_offset(mas, slot);