From: Liam R. Howlett Date: Sat, 18 Jul 2020 00:28:49 +0000 (-0400) Subject: maple_tree: awalk reduce again. X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a6e1703a5ba4b974fafbdb8c1074f336c2756ed9;p=users%2Fjedix%2Flinux-maple.git maple_tree: awalk reduce again. Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 1f4ba438dbefc..0c56767f5591e 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3364,6 +3364,14 @@ void *mas_prev(struct ma_state *mas, unsigned long min) } EXPORT_SYMBOL_GPL(mas_prev); +static inline unsigned long _mas_rev_awalk_min(struct ma_state *mas, + unsigned char slot, + enum maple_type type) +{ + if (!slot) + return mas->min; + return _mte_get_pivot(mas->node, slot - 1, type) + 1; +} static inline bool _mas_rev_awalk(struct ma_state *mas, unsigned long size) { enum maple_type type; @@ -3384,11 +3392,7 @@ static inline bool _mas_rev_awalk(struct ma_state *mas, unsigned long size) do { void *entry = NULL; - if (!i) - min = mas->min; - else - min = _mte_get_pivot(mas->node, i - 1, - type) + 1; + min = _mas_rev_awalk_min(mas, i, type); /* last is below this range */ if (mas->last < min) @@ -3431,12 +3435,7 @@ next_slot: default: do { - if (!i) - min = mas->min; - else - min = _mte_get_pivot(mas->node, i - 1, - type) + 1; - + min = _mas_rev_awalk_min(mas, i, type); /* last is too little for this range */ if (mas->last < min)