From: Liam R. Howlett Date: Tue, 8 Sep 2020 17:00:59 +0000 (-0400) Subject: maple_tree: use mte_slots for dup X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=6c84cc0163b78a0e6eec127b3ace11adf9848851;p=users%2Fjedix%2Flinux-maple.git maple_tree: use mte_slots for dup Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index e6b7e2ecb2add..52c0b93a8b6c8 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4377,8 +4377,10 @@ static inline void mas_dup_children(struct ma_state *mas, int *node_cnt) { struct maple_node *child; struct maple_enode *oldchild, *echild; - unsigned char slot, end = mt_slot_count(mas->node); + unsigned char offset, end = mt_slot_count(mas->node); int allocated = mas_alloc_cnt(mas); + void **slots = ma_get_slots(mte_to_node(mas->node), + mte_node_type(mas->node)); if (allocated < end) { mas->span_enode = mas->node; @@ -4390,14 +4392,14 @@ static inline void mas_dup_children(struct ma_state *mas, int *node_cnt) } - for(slot = 0; slot < end; slot++) { - oldchild = mas_get_slot(mas, slot); + for(offset = 0; offset < end; offset++) { + oldchild = slots[offset]; if (!oldchild) return; child = mas_next_alloc(mas); echild = mt_mk_node(child, mte_node_type(oldchild)); - mte_set_slot(mas->node, slot, echild); + slots[offset] = echild; memcpy(child, mte_to_node(oldchild), sizeof(struct maple_node)); } }