Re: [PATCH 2/2] maple tree: Add and fix some comments

From: Wei Yang
Date: Sun Jun 29 2025 - 19:17:09 EST


On Sat, Jun 28, 2025 at 05:26:18PM +0530, Dev Jain wrote:
>
>On 27/06/25 1:34 am, Liam R. Howlett wrote:
>> * Dev Jain <dev.jain@xxxxxxx> [250626 13:19]:
>> > Add comments explaining the fields for maple_metadata, since "end" is
>> > ambiguous and "gap" can be confused as the largest gap, whereas it
>> > is actually the offset of the largest gap.
>> >
>> > MAPLE_ROOT_NODE is used for mt_mk_root() and mt_safe_root(), indicating
>> > that it is used to mark the node as root. So fix the comment.
>> That's not quite the entire story here.
>>
>> The first pointer in the tree may not be a node at all, and may be an
>> entry. So having that bit set tells us the root of the tree is a node,
>> so the comment is correct but maybe you have a better way of expressing
>> this information?
>
>Hmm. Can you please correct me on my understanding - when we have an
>empty tree, then we insert a root and can store a value there. Now when
>we store the second entry, we allocate a node and make the root a node,
>the root points to that node, and we store the values at offsets 0 and 1.
>

Per my understanding, generally it is correct.

You may take a look at tools/testing/radix-tree/maple.c and use mt_dump() to
see how the tree changes.

>I am reading more to answer my own question.
>

--
Wei Yang
Help you, Help me