Skip to contentSkip to conversation

maple_tree: root node could be handled by !p_slot too

PATCH Applied Wei Yang 2 participants 6 messages Sep 13, 2024 – Oct 15, 2024

Subsystems (3)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 maple_tree: root node could be handled by !p_slot too

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.

CC Liam R. Howlett <[email protected]>
---
 lib/maple_tree.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
lib/maple_tree.c +1 -3
index 85bd651e7770..b5dde94cc7a9 100644
@@ -2100,9 +2100,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;
 
Signature · 1 line
2.34.1
#1 lore raw
Quoted 2 lines · Wei Yang

For a root node, mte_parent_slot() return 0, this exactly fits the following !p_slot check.

This sounds right, I will have to look deeper at it though.

Thanks,
Liam

Quoted 27 lines

So we can remove the special handling for root node.

CC Liam R. Howlett <[email protected]>
---
 lib/maple_tree.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
lib/maple_tree.c +1 -3
index 85bd651e7770..b5dde94cc7a9 100644
@@ -2100,9 +2100,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;
 
Signature · 1 line
2.34.1
author
#2 lore raw
Quoted 6 lines · Liam R. Howlett
Quoted 2 lines · Wei Yang

For a root node, mte_parent_slot() return 0, this exactly fits the following !p_slot check.

This sounds right, I will have to look deeper at it though.

Hi, Liam

I guess you are back?

Quoted 30 lines

Thanks,
Liam

Quoted 27 lines

So we can remove the special handling for root node.

CC Liam R. Howlett <[email protected]>
---
 lib/maple_tree.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
lib/maple_tree.c +1 -3
index 85bd651e7770..b5dde94cc7a9 100644
@@ -2100,9 +2100,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;
 
Signature · 1 line
2.34.1
Signature · 2 lines
Wei Yang
Help you, Help me
#3 lore raw
Quoted 11 lines · Wei Yang
Quoted 6 lines · Liam R. Howlett
Quoted 2 lines · Wei Yang

For a root node, mte_parent_slot() return 0, this exactly fits the following !p_slot check.

This sounds right, I will have to look deeper at it though.

Hi, Liam

I guess you are back?

Yes. I'll get to this soon. I believe you have two sets (or three?) I have to look at.

Thanks,
Liam

Quoted 35 lines
Quoted 31 lines

Thanks,
Liam

Quoted 27 lines

So we can remove the special handling for root node.

CC Liam R. Howlett <[email protected]>
---
 lib/maple_tree.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
lib/maple_tree.c +1 -3
index 85bd651e7770..b5dde94cc7a9 100644
@@ -2100,9 +2100,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;
 
Signature · 1 line
2.34.1
Signature · 2 lines
Wei Yang
Help you, Help me
author
#4 lore raw
Quoted 9 lines · Liam R. Howlett
Quoted 8 lines · Wei Yang
Quoted 6 lines · Liam R. Howlett
Quoted 2 lines · Wei Yang

For a root node, mte_parent_slot() return 0, this exactly fits the following !p_slot check.

This sounds right, I will have to look deeper at it though.

Quoted 6 lines
Quoted 3 lines

Hi, Liam

I guess you are back?

Yes. I'll get to this soon. I believe you have two sets (or three?) I have to look at.

Thanks, I have sent other two.

While I have accumulated other changes, not sure you prefer to hold a while or it is okay to go on.

Quoted 4 lines

Thanks,
Liam

Signature · 2 lines
Wei Yang
Help you, Help me
Reviewed-by on v1 1/1
#5 lore raw
In reply to Wei Yang
Quoted 7 lines · Wei Yang

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.

CC Liam R. Howlett <[email protected]>
Quoted 22 lines
---
 lib/maple_tree.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
lib/maple_tree.c +1 -3
index 85bd651e7770..b5dde94cc7a9 100644
@@ -2100,9 +2100,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;
 
Signature · 1 line
2.34.1