diff mbox series

[4/4] maple_tree: only root node could be deficient

Message ID 20241020024628.22469-5-richard.weiyang@gmail.com (mailing list archive)
State New
Headers show
Series maple_tree: current split may result in deficient node | expand

Commit Message

Wei Yang Oct. 20, 2024, 2:46 a.m. UTC
Each level's right most node could have (max == ULONG_MAX).

Only root node could be deficient.

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

Liam R. Howlett Oct. 20, 2024, 9:56 p.m. UTC | #1
* Wei Yang <richard.weiyang@gmail.com> [241019 22:46]:
> Each level's right most node could have (max == ULONG_MAX).

I think each levels right most node MUST have max == ULONX_MAX.

> 
> Only root node could be deficient.

No, root node deficient is defined as having 1 entry.  Only the root
node may be below the minimum data threshold.

> 
> 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 c2d4b188646c..e6b2ab5e27b0 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -7610,7 +7610,7 @@ void mt_validate(struct maple_tree *mt)
>  		MAS_WARN_ON(&mas, mte_dead_node(mas.node));
>  		end = mas_data_end(&mas);
>  		if (MAS_WARN_ON(&mas, (end < mt_min_slot_count(mas.node)) &&
> -				(mas.max != ULONG_MAX))) {
> +				(!mte_is_root(mas.node)))) {
>  			pr_err("Invalid size %u of %p\n", end, mas_mn(&mas));
>  		}
>  
> -- 
> 2.34.1
>
Wei Yang Nov. 3, 2024, 11:15 p.m. UTC | #2
On Sun, Oct 20, 2024 at 05:56:36PM -0400, Liam R. Howlett wrote:
>* Wei Yang <richard.weiyang@gmail.com> [241019 22:46]:
>> Each level's right most node could have (max == ULONG_MAX).
>
>I think each levels right most node MUST have max == ULONX_MAX.
>

Yes, I should be more accurate.

Will adjust the message.

>> 
>> Only root node could be deficient.
>
>No, root node deficient is defined as having 1 entry.  Only the root
>node may be below the minimum data threshold.
>

Thanks, would rephrase it to 

"Only the root node may be below the minimum data threshold.".

>> 
>> 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 c2d4b188646c..e6b2ab5e27b0 100644
>> --- a/lib/maple_tree.c
>> +++ b/lib/maple_tree.c
>> @@ -7610,7 +7610,7 @@ void mt_validate(struct maple_tree *mt)
>>  		MAS_WARN_ON(&mas, mte_dead_node(mas.node));
>>  		end = mas_data_end(&mas);
>>  		if (MAS_WARN_ON(&mas, (end < mt_min_slot_count(mas.node)) &&
>> -				(mas.max != ULONG_MAX))) {
>> +				(!mte_is_root(mas.node)))) {

The change here looks good?

>>  			pr_err("Invalid size %u of %p\n", end, mas_mn(&mas));

BTW, this patch could apply on top of current mm-unstable, since this line is
changed. Will rebase it in next spin. 

>>  		}
>>  
>> -- 
>> 2.34.1
>>
diff mbox series

Patch

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index c2d4b188646c..e6b2ab5e27b0 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -7610,7 +7610,7 @@  void mt_validate(struct maple_tree *mt)
 		MAS_WARN_ON(&mas, mte_dead_node(mas.node));
 		end = mas_data_end(&mas);
 		if (MAS_WARN_ON(&mas, (end < mt_min_slot_count(mas.node)) &&
-				(mas.max != ULONG_MAX))) {
+				(!mte_is_root(mas.node)))) {
 			pr_err("Invalid size %u of %p\n", end, mas_mn(&mas));
 		}