From: Wei Yang <richard.weiyang@gmail.com>
To: akpm@linux-foundation.org, Liam.Howlett@oracle.com
Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org,
Wei Yang <richard.weiyang@gmail.com>,
"Liam R . Howlett" <Liam.Howlett@Oracle.com>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
Sidhartha Kumar <sidhartha.kumar@oracle.com>
Subject: [PATCH 2/3] maple_tree: not possible to be a root node after loop
Date: Sat, 16 Nov 2024 01:48:04 +0000 [thread overview]
Message-ID: <20241116014805.11547-3-richard.weiyang@gmail.com> (raw)
In-Reply-To: <20241116014805.11547-1-richard.weiyang@gmail.com>
Empty tree and single entry tree is handled else whether, so the maple
tree here must be a tree with nodes.
If the height is 1 and we found the gap, it will jump to *done* since it
is also a leaf.
If the height is more than one, and there may be an available range, we
will descend the tree, which is not root anymore.
If there is no available range, we will set error and return.
This means the check for root node here is not necessary.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Liam R. Howlett <Liam.Howlett@Oracle.com>
CC: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
CC: Sidhartha Kumar <sidhartha.kumar@oracle.com>
---
lib/maple_tree.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 63dccd7b9474..ab235d0194f7 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -4891,7 +4891,7 @@ static inline bool mas_anode_descend(struct ma_state *mas, unsigned long size)
if (gap >= size) {
if (ma_is_leaf(type)) {
found = true;
- goto done;
+ break;
}
mas->node = mas_slot(mas, slots, offset);
@@ -4908,9 +4908,6 @@ static inline bool mas_anode_descend(struct ma_state *mas, unsigned long size)
}
}
- if (mte_is_root(mas->node))
- found = true;
-done:
mas->offset = offset;
return found;
}
--
2.34.1
next prev parent reply other threads:[~2024-11-16 1:48 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-16 1:48 [PATCH 0/3] mas_anode_descend() related cleanup Wei Yang
2024-11-16 1:48 ` [PATCH 1/3] maple_tree: index has been checked to be smaller than pivot Wei Yang
2024-11-18 20:53 ` Liam R. Howlett
2024-11-16 1:48 ` Wei Yang [this message]
2024-11-18 20:49 ` [PATCH 2/3] maple_tree: not possible to be a root node after loop Liam R. Howlett
2024-11-19 2:10 ` Wei Yang
2024-11-19 14:12 ` Liam R. Howlett
2024-11-21 7:13 ` Wei Yang
2024-11-22 15:17 ` Liam R. Howlett
2024-11-16 1:48 ` [PATCH 3/3] maple_tree: we don't set offset to MAPLE_NODE_SLOTS on error Wei Yang
2024-11-18 20:50 ` Liam R. Howlett
2024-11-19 2:15 ` Wei Yang
2024-11-19 13:58 ` Liam R. Howlett
2024-11-21 7:15 ` Wei Yang
2024-11-22 15:18 ` Liam R. Howlett
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241116014805.11547-3-richard.weiyang@gmail.com \
--to=richard.weiyang@gmail.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=maple-tree@lists.infradead.org \
--cc=sidhartha.kumar@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox