[PATCH] maple_tree: use xa_is_internal() for better reading
Liam R. Howlett
Liam.Howlett at oracle.com
Thu Aug 8 09:53:55 PDT 2024
* Wei Yang <richard.weiyang at gmail.com> [240808 00:38]:
> If entry is a special case, we need to expand root to store it. This
> case is exactly the case of xa_is_internal().
>
> Let's use xa_is_internal() for the check, which is friendly for
> audience.
Nack
This check is to see if it will be detected as an internal node - this
much is correct.
But changing the check to use this function reads far worse than what
exists today. If you look at the code below, it seems to indicate that
the internal entry is being inserted into the tree - but it's not an
internal entry, it's an entry that would be detected as an internal
entry.
This is not friendlier for the audience, it's confusing.
>
> Signed-off-by: Wei Yang <richard.weiyang at gmail.com>
> ---
> lib/maple_tree.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index aa3a5df15b8e..d39b0bceb802 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -3515,7 +3515,7 @@ static inline void mas_store_root(struct ma_state *mas, void *entry)
> {
> if (likely((mas->last != 0) || (mas->index != 0)))
> mas_root_expand(mas, entry);
> - else if (((unsigned long) (entry) & 3) == 2)
> + else if (xa_is_internal(entry))
> mas_root_expand(mas, entry);
> else {
> rcu_assign_pointer(mas->tree->ma_root, entry);
> --
> 2.34.1
>
More information about the maple-tree
mailing list