]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Optimize mas_node_walk() for reads only
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 12 Oct 2021 14:17:49 +0000 (10:17 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Wed, 20 Oct 2021 19:23:10 +0000 (15:23 -0400)
Now that only reads use mas_node_walk(), there are some situations which will not
need to be checked.  offset always starts at zero.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
lib/maple_tree.c

index eff82d9854841dd4a1dbea22fafb07d106a0a939..0e65002fa26c616c7f357ca86ad4b2c66f6f9efb 100644 (file)
@@ -3679,23 +3679,17 @@ static inline void mas_node_walk(struct ma_state *mas, struct maple_node *node,
                return;
        }
 
-       offset = mas->offset;
-       min = mas_safe_min(mas, pivots, offset);
+       offset = 0;
+       min = mas->min;
        max = pivots[offset];
        if (unlikely(ma_dead_node(node)))
                return;
 
        count = mt_pivots[type];
-       if (unlikely(offset == count))
-               goto max;
-
        index = mas->index;
        if (unlikely(index <= max))
                goto done;
 
-       if (unlikely(!max && offset))
-               goto max;
-
        offset++;
        min = max + 1;
        while (offset < count) {
@@ -3713,7 +3707,6 @@ static inline void mas_node_walk(struct ma_state *mas, struct maple_node *node,
                offset++;
        }
 
-max:
        max = mas->max;
 done:
        *range_max = max;