From fc53b766509a16f42b1786dd46d4b838fc0c4151 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Tue, 3 Nov 2020 21:33:58 -0500 Subject: [PATCH] maple_tree: Optimize __mas_next a bit, I hope Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 008d67678154..3981ec55a009 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3720,24 +3720,23 @@ static inline void *__mas_next(struct ma_state *mas, unsigned long limit, unsigned long *range_start) { void *entry = NULL; + struct maple_enode *prev_node; unsigned long index = mas->index; - unsigned char slot; mas->offset++; retry: *range_start = mas->last + 1; while (!mas_is_none(mas)) { - struct maple_enode *last_node = mas->node; - slot = mas->offset; - if (slot >= mt_slot_count(mas->node)) + if (mas->offset >= mt_slot_count(mas->node)) goto next_node; if (!mte_is_leaf(mas->node) || !mas->offset) { + prev_node = mas->node; *range_start = mas_first_entry(mas, limit); if (mas_is_none(mas)) { - mas->node = last_node; + mas->node = prev_node; goto next_node; } } -- 2.50.1