diff mbox series

[1/3] maple_tree: index has been checked to be smaller than pivot

Message ID 20241116014805.11547-2-richard.weiyang@gmail.com (mailing list archive)
State New
Headers show
Series mas_anode_descend() related cleanup | expand

Commit Message

Wei Yang Nov. 16, 2024, 1:48 a.m. UTC
At the beginning of loop, it has checked the range is in lower bounds.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Liam R. Howlett <Liam.Howlett@Oracle.com>
CC: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
CC: Sidhartha Kumar <sidhartha.kumar@oracle.com>
---
 lib/maple_tree.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Liam R. Howlett Nov. 18, 2024, 8:53 p.m. UTC | #1
* Wei Yang <richard.weiyang@gmail.com> [241115 20:48]:
> At the beginning of loop, it has checked the range is in lower bounds.
> 
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> CC: Liam R. Howlett <Liam.Howlett@Oracle.com>
> CC: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> CC: Sidhartha Kumar <sidhartha.kumar@oracle.com>

looks good.

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

> ---
>  lib/maple_tree.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index 667326717f35..63dccd7b9474 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -4893,13 +4893,12 @@ static inline bool mas_anode_descend(struct ma_state *mas, unsigned long size)
>  				found = true;
>  				goto done;
>  			}
> -			if (mas->index <= pivot) {
> -				mas->node = mas_slot(mas, slots, offset);
> -				mas->min = min;
> -				mas->max = pivot;
> -				offset = 0;
> -				break;
> -			}
> +
> +			mas->node = mas_slot(mas, slots, offset);
> +			mas->min = min;
> +			mas->max = pivot;
> +			offset = 0;
> +			break;
>  		}
>  next_slot:
>  		min = pivot + 1;
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 667326717f35..63dccd7b9474 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -4893,13 +4893,12 @@  static inline bool mas_anode_descend(struct ma_state *mas, unsigned long size)
 				found = true;
 				goto done;
 			}
-			if (mas->index <= pivot) {
-				mas->node = mas_slot(mas, slots, offset);
-				mas->min = min;
-				mas->max = pivot;
-				offset = 0;
-				break;
-			}
+
+			mas->node = mas_slot(mas, slots, offset);
+			mas->min = min;
+			mas->max = pivot;
+			offset = 0;
+			break;
 		}
 next_slot:
 		min = pivot + 1;