[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230425110511.11680-7-zhangpeng.00@bytedance.com>
Date: Tue, 25 Apr 2023 19:05:08 +0800
From: Peng Zhang <zhangpeng.00@...edance.com>
To: Liam.Howlett@...cle.com
Cc: akpm@...ux-foundation.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, maple-tree@...ts.infradead.org,
Peng Zhang <zhangpeng.00@...edance.com>
Subject: [PATCH 6/9] maple_tree: Remove a confusing check
After this loop, we are at the last slot of a node. Our purpose is to
find an entry that is not NULL, but the pivot is checked here, delete
it, and change to mas_logical_pivot() to get the pivot. Finally, only
check whether the entry is NULL.
Why is this confusing? If the pivot is equal to 0, but if the entry is
not NULL at this time, it will return NULL because of the pivot, but it
should not do this, the entry is valid.
Signed-off-by: Peng Zhang <zhangpeng.00@...edance.com>
---
lib/maple_tree.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 7f4b2ce84ce61..83441ef2e1f57 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -4742,17 +4742,13 @@ static inline void *mas_next_nentry(struct ma_state *mas,
return NULL;
}
- pivot = mas_safe_pivot(mas, pivots, mas->offset, type);
+ pivot = mas_logical_pivot(mas, pivots, mas->offset, type);
entry = mas_slot(mas, slots, mas->offset);
if (ma_dead_node(node))
return NULL;
- if (!pivot)
- return NULL;
-
if (!entry)
return NULL;
-
found:
mas->last = pivot;
return entry;
--
2.20.1
Powered by blists - more mailing lists