Re: [PATCH 2/3] maple_tree: not possible to be a root node after loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Wei Yang <richard.weiyang@xxxxxxxxx> [241115 20:48]:
> Empty tree and single entry tree is handled else whether, so the maple
> tree here must be a tree with nodes.
> 
> If the height is 1 and we found the gap, it will jump to *done* since it
> is also a leaf.
> If the height is more than one, and there may be an available range, we
> will descend the tree, which is not root anymore.
> 
> If there is no available range, we will set error and return.

Isn't this needed for the overflow case?  That is, if there is a range
that ends at ULONG_MAX, then we will break from the loop on the offset
limit, but not check for root, return false, and continue to loop.

> 
> This means the check for root node here is not necessary.
> 
> Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx>
> CC: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx>
> CC: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
> CC: Sidhartha Kumar <sidhartha.kumar@xxxxxxxxxx>
> ---
>  lib/maple_tree.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index 63dccd7b9474..ab235d0194f7 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -4891,7 +4891,7 @@ static inline bool mas_anode_descend(struct ma_state *mas, unsigned long size)
>  		if (gap >= size) {
>  			if (ma_is_leaf(type)) {
>  				found = true;
> -				goto done;
> +				break;
>  			}
>  
>  			mas->node = mas_slot(mas, slots, offset);
> @@ -4908,9 +4908,6 @@ static inline bool mas_anode_descend(struct ma_state *mas, unsigned long size)
>  		}
>  	}
>  
> -	if (mte_is_root(mas->node))
> -		found = true;
> -done:
>  	mas->offset = offset;
>  	return found;
>  }
> -- 
> 2.34.1
> 




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux