diff mbox series

[20/34] maple_tree: Remove unnecessary check from mas_destroy()

Message ID 20230425140955.3834476-21-Liam.Howlett@oracle.com (mailing list archive)
State New
Headers show
Series Maple tree mas_{next,prev}_range() and cleanup | expand

Commit Message

Liam R. Howlett April 25, 2023, 2:09 p.m. UTC
mas_destroy currently checks if mas->node is MAS_START prior to calling
mas_start(), but this is unnecessary as mas_start() will do nothing if
the node is anything but MAS_START.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
---
 lib/maple_tree.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Peng Zhang April 26, 2023, 9:59 a.m. UTC | #1
在 2023/4/25 22:09, Liam R. Howlett 写道:
> mas_destroy currently checks if mas->node is MAS_START prior to calling
> mas_start(), but this is unnecessary as mas_start() will do nothing if
> the node is anything but MAS_START.
>
> Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Reviewed-by: Peng Zhang <zhangpeng.00@bytedance.com>
> ---
>   lib/maple_tree.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index 89e30462f8b62..35c6e12ca9482 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -5817,9 +5817,7 @@ void mas_destroy(struct ma_state *mas)
>   	if (mas->mas_flags & MA_STATE_REBALANCE) {
>   		unsigned char end;
>   
> -		if (mas_is_start(mas))
> -			mas_start(mas);
> -
> +		mas_start(mas);
>   		mtree_range_walk(mas);
>   		end = mas_data_end(mas) + 1;
>   		if (end < mt_min_slot_count(mas->node) - 1)
diff mbox series

Patch

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 89e30462f8b62..35c6e12ca9482 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -5817,9 +5817,7 @@  void mas_destroy(struct ma_state *mas)
 	if (mas->mas_flags & MA_STATE_REBALANCE) {
 		unsigned char end;
 
-		if (mas_is_start(mas))
-			mas_start(mas);
-
+		mas_start(mas);
 		mtree_range_walk(mas);
 		end = mas_data_end(mas) + 1;
 		if (end < mt_min_slot_count(mas->node) - 1)