summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--lib/maple_tree.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 96be96a1f35d..08e41a993eb6 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -3870,18 +3870,13 @@ static inline void *mtree_lookup_walk(struct ma_state *mas)
 		end = ma_data_end(node, type, pivots, max);
 		if (unlikely(ma_dead_node(node)))
 			goto dead_node;
-
-		if (pivots[offset] >= mas->index)
-			goto next;
-
 		do {
-			offset++;
-		} while ((offset < end) && (pivots[offset] < mas->index));
-
-		if (likely(offset > end))
-			max = pivots[offset];
+			if (pivots[offset] >= mas->index) {
+				max = pivots[offset];
+				break;
+			}
+		} while (++offset < end);
 
-next:
 		slots = ma_slots(node, type);
 		next = mt_slot(mas->tree, slots, offset);
 		if (unlikely(ma_dead_node(node)))