maple_tree: Fix coalesce to skip duplicate pivots and to run on leaves
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 2 Aug 2019 18:43:02 +0000 (14:43 -0400)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 2 Aug 2019 18:43:02 +0000 (14:43 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c

index d32b23ec6dc049f5294fa1b02a63f98e8ced0015..59a3846e369c6d2646b0b2654c168e7b5bca4777 100644 (file)
@@ -2299,9 +2299,6 @@ static inline int mas_coalesce(struct ma_state *mas, unsigned char s_slot)
        unsigned char pivot_cnt;
        //bool check_prev = false;
 
-       if (ma_is_leaf(type))
-               return 0;
-
        slot_cnt = mt_slots[type];
        pivot_cnt = mt_pivots[type];
 
@@ -2309,13 +2306,6 @@ static inline int mas_coalesce(struct ma_state *mas, unsigned char s_slot)
                if (s_slot < pivot_cnt) {
                        unsigned long pivot = ma_get_pivot(src, s_slot);
 
-                       if (!s_slot) {
-                               last = pivot;
-                               if (mas->min == pivot)
-                                       printk("Should check coalescing of previous node\n");
-                               continue;
-                       }
-
                        if (!pivot)
                                goto done;
 
@@ -2330,6 +2320,7 @@ static inline int mas_coalesce(struct ma_state *mas, unsigned char s_slot)
                                        goto mas_error;
 
                                dst = mas->node;
+                               continue;
                        }
 
                        last = pivot;