From: Liam R. Howlett Date: Tue, 9 Nov 2021 18:25:56 +0000 (-0500) Subject: maple_tree: Drop mas_mat_free() bool flag and duplicate function for mas_mat_destroy... X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c420fbb92b76d855cca6d56bd7bb5a0f43e6e07b;p=users%2Fjedix%2Flinux-maple.git maple_tree: Drop mas_mat_free() bool flag and duplicate function for mas_mat_destroy uses Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index a65328e40b46..5ca5f319e3b8 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -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;