[PATCH 1/2] maple_tree: calculate new_end when needed

Liam R. Howlett Liam.Howlett at oracle.com
Wed Oct 16 08:04:48 PDT 2024


* Wei Yang <richard.weiyang at gmail.com> [241015 20:22]:
> For wr_exact_fit/wr_new_root, we don't need to calculate new_end.
> 
> Let's postpone it until necessary.
> 
> Signed-off-by: Wei Yang <richard.weiyang at gmail.com>
> CC: Liam R. Howlett <Liam.Howlett at Oracle.com>
> CC: Sidhartha Kumar <sidhartha.kumar at oracle.com>
> CC: Lorenzo Stoakes <lorenzo.stoakes at oracle.com>

Too bad these were missed in the review of the patches.

Reviewed-by: Liam R. Howlett <Liam.Howlett at Oracle.com>

> ---
>  lib/maple_tree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index 61de8f1daee8..f2628e3f3efc 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -4122,7 +4122,6 @@ static inline void mas_wr_store_type(struct ma_wr_state *wr_mas)
>  	if (!wr_mas->entry)
>  		mas_wr_extend_null(wr_mas);
>  
> -	new_end = mas_wr_new_end(wr_mas);
>  	if ((wr_mas->r_min == mas->index) && (wr_mas->r_max == mas->last)) {
>  		mas->store_type = wr_exact_fit;
>  		return;
> @@ -4133,6 +4132,7 @@ static inline void mas_wr_store_type(struct ma_wr_state *wr_mas)
>  		return;
>  	}
>  
> +	new_end = mas_wr_new_end(wr_mas);
>  	/* Potential spanning rebalance collapsing a node */
>  	if (new_end < mt_min_slots[wr_mas->type]) {
>  		if (!mte_is_root(mas->node)) {
> -- 
> 2.34.1
> 



More information about the maple-tree mailing list