From a886701a5c968125344b9848d4e19dd94ea2adbe Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Thu, 3 Dec 2020 22:33:17 -0500 Subject: [PATCH] maple_tree: Set max only when needed in mas_is_span_wr() Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index a67bc3ea1e96..8ae58d1fd6e4 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2954,12 +2954,13 @@ exists: bool mas_is_span_wr(struct ma_state *mas, unsigned long piv, enum maple_type type, void *entry) { + unsigned long max; unsigned long last = mas->last; - unsigned long max = mas->max; if (piv > last) // Contained in this pivot return false; + max = mas->max; if (unlikely(ma_is_leaf(type))) { if (last < max) // Fits in the node, but may span slots. return false; @@ -3002,11 +3003,9 @@ static inline void mas_node_walk(struct ma_state *mas, enum maple_type type, index = mas->index; while (offset < count) { - max = pivots[offset]; - if (unlikely(!max && offset)) { + if (unlikely(!max && offset)) break; - } if (index <= max) goto done; -- 2.50.1