]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Change adopt_Children to use ma_get_slots
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 8 Sep 2020 17:10:02 +0000 (13:10 -0400)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 30 Oct 2020 19:11:21 +0000 (15:11 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c

index 52c0b93a8b6c8860a2f8cb3e22d368f1c2e16d29..c4e768ef7fcb5a6db5c9f9ee141b0d868dd11f22 100644 (file)
@@ -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);
        }
 }