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

Sid Kumar sidhartha.kumar at oracle.com
Wed Oct 16 07:28:02 PDT 2024


On 10/15/24 8:22 PM, Wei Yang wrote:
> 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>
> ---
>   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)) {

Reviewed-by: Sidhartha Kumar <sidhartha.kumar at oracle.com>




More information about the maple-tree mailing list