diff mbox series

[v2,2/2] maple_tree: only root node could be deficient

Message ID 20241109134410.31792-3-richard.weiyang@gmail.com (mailing list archive)
State New
Headers show
Series simplify split calculation | expand

Commit Message

Wei Yang Nov. 9, 2024, 1:44 p.m. UTC
Each level's right most node should have (max == ULONG_MAX). This means
current validation skips the right most node on each level.

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>

---
v2:
  adjust the change log
---
 lib/maple_tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Liam R. Howlett Nov. 12, 2024, 2:46 p.m. UTC | #1
* Wei Yang <richard.weiyang@gmail.com> [241109 08:45]:
> Each level's right most node should have (max == ULONG_MAX). This means
> current validation skips the right most node on each level.
> 
> 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>

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

> 
> ---
> v2:
>   adjust the change log

Thanks

> ---
>  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 4f2950a1c38d..667326717f35 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -7585,7 +7585,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 " PTR_FMT "\n",
>  			       end, mas_mn(&mas));
>  		}
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 4f2950a1c38d..667326717f35 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -7585,7 +7585,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 " PTR_FMT "\n",
 			       end, mas_mn(&mas));
 		}