]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Set max only when needed in mas_is_span_wr()
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 4 Dec 2020 03:33:17 +0000 (22:33 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 5 Jan 2021 17:33:33 +0000 (12:33 -0500)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c

index a67bc3ea1e96e81a89fd4236f81c0d540b2ab06e..8ae58d1fd6e4da0fb0cdf9f7e1a1bc04298b73b6 100644 (file)
@@ -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;