maple_tree: mas_node_walk() could never return false
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Wed, 25 Nov 2020 03:37:08 +0000 (22:37 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 5 Jan 2021 17:33:28 +0000 (12:33 -0500)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c

index 6ed0e70f2326e53ba1daf0e738090412ab9fe419..39cf6bf18797081ce683fa261275abf26e13e1ac 100644 (file)
@@ -1718,7 +1718,7 @@ static inline unsigned char mas_store_b_node(struct ma_state *mas,
        return b_end;
 }
 
-static inline bool mas_node_walk(struct ma_state *mas, enum maple_type type,
+static inline void mas_node_walk(struct ma_state *mas, enum maple_type type,
                unsigned long *range_min, unsigned long *range_max);
 
 /*
@@ -1963,11 +1963,11 @@ mast_ascend_free(struct maple_subtree_state *mast)
        /* The node may not contain the value so set slot to ensure all
         * of the nodes contents are freed or destroyed.
         */
-       if (!mas_node_walk(mast->orig_r,
-                          mte_node_type(mast->orig_r->node),
-                          &range_min, &range_max)) {
+       if (mast->orig_r->max < mast->orig_r->last)
                mast->orig_r->offset = mas_data_end(mast->orig_r) + 1;
-       }
+       else
+               mas_node_walk(mast->orig_r, mte_node_type(mast->orig_r->node),
+                             &range_min, &range_max);
        /* Set up the left side of things */
        mast->orig_l->offset = 0;
        mast->orig_l->index = mast->l->min;
@@ -2934,7 +2934,7 @@ bool mas_is_span_wr(struct ma_state *mas, unsigned long piv,
        return true;
 }
 
-static inline bool mas_node_walk(struct ma_state *mas, enum maple_type type,
+static inline void mas_node_walk(struct ma_state *mas, enum maple_type type,
                unsigned long *range_min, unsigned long *range_max)
 {
        unsigned long *pivots = ma_pivots(mas_mn(mas), type);
@@ -2967,7 +2967,6 @@ static inline bool mas_node_walk(struct ma_state *mas, enum maple_type type,
 dense:
        *range_min = min;
        *range_max = pivot;
-       return true;
 }
 
 /*
@@ -3074,9 +3073,7 @@ static inline bool __mas_walk(struct ma_state *mas, unsigned long *range_min,
                mas->depth++;
                type = mte_node_type(mas->node);
 
-               if (unlikely(!mas_node_walk(mas, type, range_min, range_max)))
-                       return false;
-
+               mas_node_walk(mas, type, range_min, range_max);
                if (ma_is_leaf(type)) // Leaf.
                        return true;