Re: [PATCH 2/9] maple_tree: Make maple state reusable after mas_empty_area()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Peng Zhang <zhangpeng.00@xxxxxxxxxxxxx> [230425 07:05]:
> Make mas->min and mas->max point to a node range instead of a leaf entry
> range. This allows mas to still be usable after mas_empty_area() returns.
> This currently has no user impact because no one use mas after
> mas_empty_area() now.
> 
> Fixes: 54a611b60590 ("Maple Tree: add new data structure")
> Signed-off-by: Peng Zhang <zhangpeng.00@xxxxxxxxxxxxx>
> ---
>  lib/maple_tree.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index 72099b4b32169..aa55c914818a0 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -5320,14 +5320,7 @@ int mas_empty_area(struct ma_state *mas, unsigned long min,
>  
>  	mt = mte_node_type(mas->node);
>  	pivots = ma_pivots(mas_mn(mas), mt);
> -	if (offset)
> -		mas->min = pivots[offset - 1] + 1;
> -
> -	if (offset < mt_pivots[mt])
> -		mas->max = pivots[offset];
> -
> -	if (mas->index < mas->min)
> -		mas->index = mas->min;
> +	mas->index = max(mas->index, mas_safe_min(mas, pivots, offset));

It is better to have a few extra lines of code than a complex statement
combined into one line.  Things tend to get missed this way.

>  
>  	mas->last = mas->index + size - 1;
>  	return 0;
> -- 
> 2.20.1
> 




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux