]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Optimizer mas_node_walk() by removing special case.
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 7 Dec 2020 00:59:15 +0000 (19:59 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 5 Jan 2021 17:33:34 +0000 (12:33 -0500)
Check if offset is set is no longer necessary in the loop as it is done before.
Also, check after checing index <= max.

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

index 93ae822f17ae7de0b80063a7d766bf8c3c7e76ee..deff629c347a1b50f4a0e0ba79771093048e4e4f 100644 (file)
@@ -3019,14 +3019,21 @@ static inline void mas_node_walk(struct ma_state *mas, enum maple_type type,
                goto max;
 
        index = mas->index;
+       max = pivots[offset];
+       if (index <= max)
+               goto done;
+       if (unlikely(!max && offset))
+               goto max;
+       offset++;
+       min = max + 1;
        while (offset < count) {
                max = pivots[offset];
-               if (unlikely(!max && offset))
-                       break;
-
                if (index <= max)
                        goto done;
 
+               if (unlikely(!max))
+                       break;
+
                min = max + 1;
                offset++;
        }