From ba8faf12d84b8034effa7fcc83864508a16c6c3c Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Thu, 10 Dec 2020 21:53:08 -0500 Subject: [PATCH] maple_tree: Make mas_max_gap() only set gaps when necessary Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 7a1d2937b4a2c..21e40d3909512 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -1169,16 +1169,16 @@ static inline unsigned long mas_max_gap(struct ma_state *mas) enum maple_type mt; struct maple_node *node; - if (mte_is_leaf(mas->node)) + mt = mte_node_type(mas->node); + if (ma_is_leaf(mt)) return mas_leaf_max_gap(mas); - mt = mte_node_type(mas->node); - node = mte_to_node(mas->node); - gaps = ma_gaps(node, mt); + node = mas_mn(mas); offset = ma_meta_gap(node, mt); if (offset == 15) return 0; + gaps = ma_gaps(node, mt); return gaps[offset]; } @@ -1240,7 +1240,8 @@ ascend: static inline void mas_update_gap(struct ma_state *mas) { unsigned char pslot; - unsigned long p_gap, max_gap = 0; + unsigned long p_gap; + unsigned long max_gap; if (!mt_is_alloc(mas->tree)) return; -- 2.50.1