]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: root node could be handled by !p_slot too
authorWei Yang <richard.weiyang@gmail.com>
Fri, 13 Sep 2024 06:31:28 +0000 (06:31 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 1 Nov 2024 04:29:08 +0000 (21:29 -0700)
For a root node, mte_parent_slot() return 0, this exactly fits the
following !p_slot check.

So we can remove the special handling for root node.

Link: https://lkml.kernel.org/r/20240913063128.27391-1-richard.weiyang@gmail.com
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/maple_tree.c

index cdac15168405b33210ca91827e0ec28fabb7571f..c2d3c8d273584c75619656faf2cb382291e4b9ce 100644 (file)
@@ -2155,9 +2155,7 @@ static inline bool mas_prev_sibling(struct ma_state *mas)
 {
        unsigned int p_slot = mte_parent_slot(mas->node);
 
-       if (mte_is_root(mas->node))
-               return false;
-
+       /* For root node, p_slot is set to 0 by mte_parent_slot(). */
        if (!p_slot)
                return false;