]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Drop mas_mat_free() bool flag and duplicate function for mas_mat_destroy...
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 9 Nov 2021 18:25:56 +0000 (13:25 -0500)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Wed, 10 Nov 2021 03:44:23 +0000 (22:44 -0500)
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
lib/maple_tree.c

index a65328e40b46f5669c788b986e15bef61a2cd63e..5ca5f319e3b8733eb83a03d138ebf15de8aa4a8e 100644 (file)
@@ -934,28 +934,38 @@ static void mte_destroy_walk(struct maple_enode *, struct maple_tree *);
 static inline void mas_free(struct ma_state *mas, struct maple_enode *used);
 
 /*
- * mat_free() - Free all nodes in a dead list.
+ * mas_mat_free() - Free all nodes in a dead list.
  * @mat - the ma_topiary linked list of dead nodes to free.
- * @recursive - specifies if this sub-tree is to be freed or just the single
- * node.
  *
- * Free or destroy walk a dead list.
+ * Free walk a dead list.
  */
-static void mas_mat_free(struct ma_state *mas, struct ma_topiary *mat,
-                               bool recursive)
+static void mas_mat_free(struct ma_state *mas, struct ma_topiary *mat)
 {
        struct maple_enode *next;
 
        while (mat->head) {
                next = mte_to_mat(mat->head)->next;
-               if (recursive)
-                       mte_destroy_walk(mat->head, mat->mtree);
-               else
-                       mas_free(mas, mat->head);
+               mas_free(mas, mat->head);
                mat->head = next;
        }
 }
 
+/*
+ * mas_mat_destroy() - Free all nodes and subtrees in a dead list.
+ * @mat - the ma_topiary linked list of dead nodes to free.
+ *
+ * Destroy walk a dead list.
+ */
+static void mas_mat_destroy(struct ma_state *mas, struct ma_topiary *mat)
+{
+       struct maple_enode *next;
+
+       while (mat->head) {
+               next = mte_to_mat(mat->head)->next;
+               mte_destroy_walk(mat->head, mat->mtree);
+               mat->head = next;
+       }
+}
 /*
  * mas_descend() - Descend into the slot stored in the ma_state.
  * @mas - the maple state.
@@ -2587,10 +2597,10 @@ static inline void mas_wmb_replace(struct ma_state *mas,
        if (!mte_is_leaf(mas->node))
                mas_descend_adopt(mas);
 
-       mas_mat_free(mas, free, false);
+       mas_mat_free(mas, free);
 
        if (destroy)
-               mas_mat_free(mas, destroy, true);
+               mas_mat_destroy(mas, destroy);
 
        if (mte_is_leaf(mas->node))
                return;