From: Liam R. Howlett Date: Fri, 4 Dec 2020 03:33:17 +0000 (-0500) Subject: maple_tree: Set max only when needed in mas_is_span_wr() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a886701a5c968125344b9848d4e19dd94ea2adbe;p=users%2Fjedix%2Flinux-maple.git maple_tree: Set max only when needed in mas_is_span_wr() Signed-off-by: Liam R. Howlett --- 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;