From: Liam R. Howlett Date: Tue, 8 Sep 2020 17:10:02 +0000 (-0400) Subject: maple_tree: Change adopt_Children to use ma_get_slots X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=2aafe0b230bda164954c352aee7f09fbbd764443;p=users%2Fjedix%2Flinux-maple.git maple_tree: Change adopt_Children to use ma_get_slots Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 52c0b93a8b6c..c4e768ef7fcb 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -1264,18 +1264,15 @@ static inline void mas_adopt_children(struct ma_state *mas, { enum maple_type type = mte_node_type(parent); - unsigned char slot_cnt = mt_slots[type]; + void **slots = ma_get_slots(mte_to_node(mas->node), type); struct maple_enode *child; - unsigned char slot; + unsigned char offset; - for (slot = 0; slot < slot_cnt; slot++) { - if (slot != 0 && slot < slot_cnt - 1 && - _mte_get_pivot(parent, slot, type) == 0) + for (offset = 0; offset < mt_slots[type]; offset++) { + child = slots[offset]; + if (!child) break; - - child = _mte_get_slot(parent, slot, type, mas->tree); - if (child) - mte_set_parent(child, parent, slot); + mte_set_parent(child, parent, offset); } }