[PATCH 2/3] maple_tree: not possible to be a root node after loop
Liam R. Howlett
Liam.Howlett at oracle.com
Tue Nov 19 06:12:31 PST 2024
* Wei Yang <richard.weiyang at gmail.com> [241118 21:10]:
> 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.
I am concerned of the case where there isn't a gap in the last slot of a
leaf root node. Examining it, I think we are okay.
next_slot:
min = pivot + 1; <-----min = 0, overflow.
if (mas->last <= pivot) { <-- still okay.
mas_set_err(mas, -EBUSY);
return true;
}
More information about the maple-tree
mailing list