From: Liam R. Howlett Date: Mon, 7 Dec 2020 20:58:39 +0000 (-0500) Subject: maple_tree: Rework mas_first_entry() for leaf case X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=5bcf6cf7d328ad45ec192cf93df1b534d3aa2996;p=users%2Fjedix%2Flinux-maple.git maple_tree: Rework mas_first_entry() for leaf case Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 0a4b1221a9e5..c5cecbec4a66 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -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;