diff mbox series

[1/2] maple_tree: calculate new_end when needed

Message ID 20241016002221.32428-2-richard.weiyang@gmail.com (mailing list archive)
State New
Headers show
Series Following cleanup after introduce mas_wr_store_type() | expand

Commit Message

Wei Yang Oct. 16, 2024, 12:22 a.m. UTC
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@gmail.com>
CC: Liam R. Howlett <Liam.Howlett@Oracle.com>
CC: Sidhartha Kumar <sidhartha.kumar@oracle.com>
CC: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
---
 lib/maple_tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sidhartha Kumar Oct. 16, 2024, 2:28 p.m. UTC | #1
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@gmail.com>
> CC: Liam R. Howlett <Liam.Howlett@Oracle.com>
> CC: Sidhartha Kumar <sidhartha.kumar@oracle.com>
> CC: Lorenzo Stoakes <lorenzo.stoakes@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@oracle.com>
Liam R. Howlett Oct. 16, 2024, 3:04 p.m. UTC | #2
* Wei Yang <richard.weiyang@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@gmail.com>
> CC: Liam R. Howlett <Liam.Howlett@Oracle.com>
> CC: Sidhartha Kumar <sidhartha.kumar@oracle.com>
> CC: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>

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

Reviewed-by: Liam R. Howlett <Liam.Howlett@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
>
diff mbox series

Patch

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)) {