From e3ec013a067d2d474eaf50b7bffa1f2ebd5f4396 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Fri, 17 Jul 2020 20:23:12 -0400 Subject: [PATCH] maple_tree: awalk is still massive Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 9cad1d1b3e2c..1f4ba438dbef 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3118,9 +3118,6 @@ no_entry: } - - - /** Private * prev node entry */ @@ -3415,21 +3412,15 @@ static inline bool _mas_rev_awalk(struct ma_state *mas, unsigned long size) this_gap += max - min + 1; if (this_gap >= size) { - /* within range and large enough */ - if (mas->last - min + 1 < size) { - /* It is possible that the gap is - * sufficient and within range, but - * the size does not fit within the - * maximum value and the min of gap - */ + if (mas->last - min + 1 < size) goto next_slot; - } mas->min = min; mas->max = min + this_gap - 1; i = start; found = true; break; } + next_slot: if (!i) goto ascend; @@ -3451,7 +3442,6 @@ next_slot: if (mas->last < min) goto next; - /* index is too large for this range */ if (mas->index > max) { mas_set_err(mas, -EBUSY); @@ -3466,7 +3456,6 @@ next_slot: break; next: - /* Not found in this node.*/ if (!i) goto ascend; @@ -3479,25 +3468,22 @@ next: break; case maple_dense: - // FIXME: find a line of nulls... i = mas->index - mas->min; found = true; break; } - if (!ma_is_leaf(type)) { //descend struct maple_enode *next; next = mas_get_rcu_slot(mas, i); mas->min = min; mas->max = max; - if (!mt_is_empty(next)) { - mas->node = next; - i = _mas_data_end(mas, mte_node_type(next), &max); - } else { + if (mt_is_empty(next)) goto ascend; - } + + mas->node = next; + i = _mas_data_end(mas, mte_node_type(next), &max); } mas_set_slot(mas, i); -- 2.50.1