From bb3473d577af26601e4cca0635735952880958a8 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Tue, 22 Feb 2022 11:57:30 -0500 Subject: [PATCH] maple_tree: Make mtree_range_walk() more efficient Only check offset < end Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 66fea07cb8d39..41d1bcbdaa18d 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: -- 2.50.1