From: Liam R. Howlett <Liam.Howlett@oracle.com>
Date: Tue, 22 Feb 2022 16:57:30 +0000 (-0500)
Subject: maple_tree: Make mtree_range_walk() more efficient
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=bb3473d577af26601e4cca0635735952880958a8;p=users%2Fjedix%2Flinux-maple.git

maple_tree: Make mtree_range_walk() more efficient

Only check offset < end

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
---

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 66fea07cb8d3..41d1bcbdaa18 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -2815,14 +2815,9 @@ static inline void *mtree_range_walk(struct ma_state *mas)
 		} while((offset < end) && (pivots[offset] < mas->index));
 
 		prev_min = min;
+		min = pivots[offset - 1] + 1;
 		prev_max = max;
-		if (offset < mt_pivots[type] && pivots[offset])
-			max = pivots[offset];
-
-		if (offset)
-			min = pivots[offset - 1] + 1;
-
-		if (likely(offset > end) && pivots[offset])
+		if (likely(offset < end && pivots[offset]))
 			max = pivots[offset];
 
 next: