Skip to contentSkip to conversation

maple_tree: arange64 node is not a leaf node

PATCH Applied Wei Yang 3 participants 6 messages Aug 26, 2024 – Aug 28, 2024

Subsystems (2)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/2 maple_tree: arange64 node is not a leaf node

mt_dump_arange64() only applies to an entry whose type is maple_arange_64, in which mte_is_leaf() must return false.

Since mte_is_leaf() here is always false, we can remove this condition check.

---
 lib/maple_tree.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
lib/maple_tree.c +1 -5
index 5dd9d9db4fdc..236b58fd9be4 100644
@@ -7177,7 +7177,6 @@ static void mt_dump_arange64(const struct maple_tree *mt, void *entry,
 	enum mt_dump_format format)
 {
 	struct maple_arange_64 *node = &mte_to_node(entry)->ma64;
-	bool leaf = mte_is_leaf(entry);
 	unsigned long first = min;
 	int i;
 
@@ -7211,10 +7210,7 @@ static void mt_dump_arange64(const struct maple_tree *mt, void *entry,
 			break;
 		if (last == 0 && i > 0)
 			break;
-		if (leaf)
-			mt_dump_entry(mt_slot(mt, node->slot, i),
-					first, last, depth + 1, format);
-		else if (node->slot[i])
+		if (node->slot[i])
 			mt_dump_node(mt, mt_slot(mt, node->slot, i),
 					first, last, depth + 1, format);
 
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 2/2 maple_tree: dump error message based on format

Just do what mt_dump_range64() does.

Dump the error message based on format.

---
 lib/maple_tree.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
lib/maple_tree.c +8 -2
index 236b58fd9be4..0c06a4c6d3bd 100644
@@ -7217,9 +7217,15 @@ static void mt_dump_arange64(const struct maple_tree *mt, void *entry,
 		if (last == max)
 			break;
 		if (last > max) {
-			pr_err("node %p last (%lu) > max (%lu) at pivot %d!\n",
+			switch(format) {
+			case mt_dump_hex:
+				pr_err("node %p last (%lx) > max (%lx) at pivot %d!\n",
 					node, last, max, i);
-			break;
+				break;
+			case mt_dump_dec:
+				pr_err("node %p last (%lu) > max (%lu) at pivot %d!\n",
+					node, last, max, i);
+			}
 		}
 		first = last + 1;
 	}
Signature · 1 line
2.34.1
maintainer
#2 lore raw
In reply to Wei Yang
Quoted 6 lines · On Mon, 26 Aug 2024 01:24:21 +0000 Wei Yang <[email protected]> wrote:

mt_dump_arange64() only applies to an entry whose type is maple_arange_64, in which mte_is_leaf() must return false.

Since mte_is_leaf() here is always false, we can remove this condition check.

These are pretty simple so I'll say lack-of-a-nack-is-an-ack ;)

Please do cc linux-mm on maple-tree changes.

author
#3 lore raw
Quoted 5 lines · Andrew Morton
Quoted 3 lines · On Mon, 26 Aug 2024 01:24:21 +0000 Wei Yang <[email protected]> wrote:

mt_dump_arange64() only applies to an entry whose type is maple_arange_64, in which mte_is_leaf() must return false.

Quoted 7 lines
Quoted 3 lines

Since mte_is_leaf() here is always false, we can remove this condition check.

These are pretty simple so I'll say lack-of-a-nack-is-an-ack ;)

Please do cc linux-mm on maple-tree changes.

Sure, will cc linux-mm next time.

Signature · 2 lines
Wei Yang
Help you, Help me
Reviewed-by
#4 lore raw
In reply to Andrew Morton
Quoted 11 lines · Andrew Morton
Quoted 6 lines · On Mon, 26 Aug 2024 01:24:21 +0000 Wei Yang <[email protected]> wrote:

mt_dump_arange64() only applies to an entry whose type is maple_arange_64, in which mte_is_leaf() must return false.

Since mte_is_leaf() here is always false, we can remove this condition check.

These are pretty simple so I'll say lack-of-a-nack-is-an-ack ;)

Let's make it official then.

author
#5 lore raw
Quoted 10 lines · Liam R. Howlett
Quoted 9 lines · Andrew Morton
Quoted 6 lines · On Mon, 26 Aug 2024 01:24:21 +0000 Wei Yang <[email protected]> wrote:

mt_dump_arange64() only applies to an entry whose type is maple_arange_64, in which mte_is_leaf() must return false.

Since mte_is_leaf() here is always false, we can remove this condition check.

Quoted 6 lines
Quoted 2 lines

These are pretty simple so I'll say lack-of-a-nack-is-an-ack ;)

Let's make it official then.

Thanks

Signature · 2 lines
Wei Yang
Help you, Help me