From: Liam R. Howlett Date: Fri, 11 Dec 2020 02:53:08 +0000 (-0500) Subject: maple_tree: Make mas_max_gap() only set gaps when necessary X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=ba8faf12d84b8034effa7fcc83864508a16c6c3c;p=users%2Fjedix%2Flinux-maple.git maple_tree: Make mas_max_gap() only set gaps when necessary Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 7a1d2937b4a2..21e40d390951 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;