From a2715c6943c2cbab2272776e1c4d326a8b3afa4c Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Tue, 29 Sep 2020 09:35:46 -0400 Subject: [PATCH] maple_tree: Add missing mas_walk() which is part of the interface Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index f31c7399dd25..88a783be04d7 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3720,6 +3720,7 @@ static inline bool _mas_walk(struct ma_state *mas, unsigned long *range_min, return __mas_walk(mas, range_min, range_max); } + static inline int mas_dead_node(struct ma_state *mas, unsigned long index) { unsigned long range_max, range_min; @@ -3736,6 +3737,19 @@ static inline int mas_dead_node(struct ma_state *mas, unsigned long index) return 1; } +void *mas_walk(struct ma_state *mas) +{ + unsigned long range_min, range_max; + unsigned long index = mas->index; + + _mas_walk(mas, &range_min, &range_max); +retry: + if (mas_dead_node(mas, index)) + goto retry; + + return mas_get_slot(mas, mas_offset(mas)); +} + static inline bool mas_search_cont(struct ma_state *mas, unsigned long index, unsigned long max, void *entry) { -- 2.50.1