Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F171741930
D50750.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D50750.id.diff
View Options
diff --git a/sys/kern/subr_pctrie.c b/sys/kern/subr_pctrie.c
--- a/sys/kern/subr_pctrie.c
+++ b/sys/kern/subr_pctrie.c
@@ -489,29 +489,28 @@
struct pctrie_node *parent;
int slot;
+ parent = node;
+ if (parent == NULL)
+ node = pctrie_root_load(ptree, smr, access);
+
/*
* Climb the search path to find the lowest node from which to start the
* search for a value matching 'index'.
*/
- while (node != NULL) {
- KASSERT(access == PCTRIE_SMR || !powerof2(node->pn_popmap),
+ while (parent != NULL) {
+ KASSERT(access == PCTRIE_SMR || !powerof2(parent->pn_popmap),
("%s: freed node in iter path", __func__));
+ node = parent;
if (!pctrie_keybarr(node, index, &slot))
break;
- node = pctrie_parent(node);
- }
-
- if (node == NULL) {
- parent = NULL;
- node = pctrie_root_load(ptree, smr, access);
- } else {
- parent = node;
- node = pctrie_node_load(&node->pn_child[slot], smr, access);
+ parent = pctrie_parent(node);
}
/* Seek a node that matches index. */
while (!pctrie_isleaf(node) && !pctrie_keybarr(node, index, &slot)) {
parent = node;
+ KASSERT(access == PCTRIE_SMR || !powerof2(parent->pn_popmap),
+ ("%s: freed node in iter path", __func__));
node = pctrie_node_load(&node->pn_child[slot], smr, access);
}
*parent_out = parent;
@@ -527,9 +526,9 @@
{
struct pctrie_node *node;
- it->index = index;
node = _pctrie_lookup_node(it->ptree, it->node, index, &it->node,
NULL, PCTRIE_LOCKED);
+ it->index = index;
return (pctrie_match_value(node, index));
}
@@ -543,9 +542,9 @@
{
struct pctrie_node *node;
- it->index = *val;
node = _pctrie_lookup_node(it->ptree, it->node, *val, &it->node,
NULL, PCTRIE_LOCKED);
+ it->index = *val;
if (node == PCTRIE_NULL) {
if (it->node == NULL)
pctrie_node_store(pctrie_root(it->ptree),
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Sep 14, 5:00 AM (1 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38831422
Default Alt Text
D50750.id.diff (1 KB)
Attached To
Mode
D50750: pctrie: simplify lookup_node
Attached
Detach File
Event Timeline
Log In to Comment