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

Wei Yang richard.weiyang at gmail.com
Mon Nov 18 18:10:07 PST 2024


On Mon, Nov 18, 2024 at 03:49:55PM -0500, Liam R. Howlett wrote:
>* Wei Yang <richard.weiyang at gmail.com> [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.
>

I may not follow you correctly.

If there is an available range that ends at ULONG_MAX for a root node, we
break the loop with two conditions:

  * the root node is a leaf node, then we will set found to true
  * the root node has children, then descend to a non-root node

Not sure this is the case you mentioned.

-- 
Wei Yang
Help you, Help me



More information about the maple-tree mailing list