[PATCH] maple_tree: Remove redundant mte_to_node() in mte_dead_node()

From: I Hsin Cheng
Date: Mon Feb 10 2025 - 03:36:00 EST


In mte_dead_node(), it already assign "node" as "mte_to_node(enode)" in
the first place, calling "mte_parent(enode)" will result in the same
"mte_to_node(enode)" again which is redundant.

Refactor mte_dead_node() and utilize ma_dead_node() to perform the
parent check without the redundant "mte_to_node()".

Signed-off-by: I Hsin Cheng <richard120310@xxxxxxxxx>
---
lib/maple_tree.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index f7153ade1be5..362f85c62678 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -584,13 +584,10 @@ static __always_inline bool ma_dead_node(const struct maple_node *node)
*/
static __always_inline bool mte_dead_node(const struct maple_enode *enode)
{
- struct maple_node *parent, *node;
+ struct maple_node *node;

node = mte_to_node(enode);
- /* Do not reorder reads from the node prior to the parent check */
- smp_rmb();
- parent = mte_parent(enode);
- return (parent == node);
+ return ma_dead_node(node);
}

/*
--
2.43.0