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.
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;