From: Liam R. Howlett Date: Wed, 10 Nov 2021 03:16:25 +0000 (-0500) Subject: maple_tree: Use ma_data_end() where possible, drop some checks from mas_tree_walk() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=32a1fde42fffb15a1fb16c797ab5bc836e09d6de;p=users%2Fjedix%2Flinux-maple.git maple_tree: Use ma_data_end() where possible, drop some checks from mas_tree_walk() Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index c6dbc9560761..8f4d044f73f4 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2167,9 +2167,10 @@ static inline void mas_wr_node_walk(struct ma_wr_state *wr_mas) } wr_mas->node = mas_mn(wr_mas->mas); - count = wr_mas->node_end = mas_data_end(mas); - offset = mas->offset; wr_mas->pivots = ma_pivots(wr_mas->node, wr_mas->type); + count = wr_mas->node_end = ma_data_end(wr_mas->node, wr_mas->type, + wr_mas->pivots, mas->max); + offset = mas->offset; min = mas_safe_min(mas, wr_mas->pivots, offset); max = wr_mas->pivots[offset]; if (unlikely(offset == count)) @@ -4507,7 +4508,7 @@ static inline int mas_prev_node(struct ma_state *mas, unsigned long min) node = mas_mn(mas); slots = ma_slots(node, mt); pivots = ma_pivots(node, mt); - offset = mas_data_end(mas); + offset = ma_data_end(node, mt, pivots, mas->max); if (offset) mas->min = pivots[offset - 1] + 1; @@ -4519,7 +4520,7 @@ static inline int mas_prev_node(struct ma_state *mas, unsigned long min) } enode = mas_slot(mas, slots, offset); - offset = mas_data_end(mas); + offset = ma_data_end(node, mt, pivots, mas->max); if (unlikely(ma_dead_node(node))) return 1; @@ -4701,16 +4702,11 @@ found: static inline bool mas_tree_walk(struct ma_state *mas, unsigned long *range_min, unsigned long *range_max) { - - void *entry; bool ret; retry: ret = false; - entry = mas_start(mas); - if (entry) - return true; - + mas_start(mas); if (mas_is_none(mas)) goto not_found;