]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Rework mas_first_entry() for leaf case
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 7 Dec 2020 20:58:39 +0000 (15:58 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 5 Jan 2021 17:33:35 +0000 (12:33 -0500)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c

index 0a4b1221a9e5a1ca444e9643a1f12a5a740108d6..c5cecbec4a66be4e58a38abb726586450f56f845 100644 (file)
@@ -1269,8 +1269,12 @@ static inline unsigned long mas_first_entry(struct ma_state *mas,
        enum maple_type mt;
 
        while (likely(!mte_is_leaf(mas->node))) {
-               max = mte_pivot(mas->node, 0);
-               mas->node = mas_get_slot(mas, 0);
+               mn = mas_mn(mas);
+               mt = mte_node_type(mas->node);
+               slots = ma_slots(mn, mt);
+               pivots = ma_pivots(mn, mt);
+               max = pivots[0];
+               mas->node = mas_slot(mas, slots, 0);
        }
 
        mas->max = max;