|
@@ -52,8 +52,8 @@ static int proc_match(const char *name, struct proc_dir_entry *de, unsigned int
|
|
|
|
|
|
static struct proc_dir_entry *pde_subdir_first(struct proc_dir_entry *dir)
|
|
static struct proc_dir_entry *pde_subdir_first(struct proc_dir_entry *dir)
|
|
{
|
|
{
|
|
- return rb_entry_safe(rb_first_cached(&dir->subdir),
|
|
|
|
- struct proc_dir_entry, subdir_node);
|
|
|
|
|
|
+ return rb_entry_safe(rb_first(&dir->subdir), struct proc_dir_entry,
|
|
|
|
+ subdir_node);
|
|
}
|
|
}
|
|
|
|
|
|
static struct proc_dir_entry *pde_subdir_next(struct proc_dir_entry *dir)
|
|
static struct proc_dir_entry *pde_subdir_next(struct proc_dir_entry *dir)
|
|
@@ -66,7 +66,7 @@ static struct proc_dir_entry *pde_subdir_find(struct proc_dir_entry *dir,
|
|
const char *name,
|
|
const char *name,
|
|
unsigned int len)
|
|
unsigned int len)
|
|
{
|
|
{
|
|
- struct rb_node *node = dir->subdir.rb_root.rb_node;
|
|
|
|
|
|
+ struct rb_node *node = dir->subdir.rb_node;
|
|
|
|
|
|
while (node) {
|
|
while (node) {
|
|
struct proc_dir_entry *de = rb_entry(node,
|
|
struct proc_dir_entry *de = rb_entry(node,
|
|
@@ -87,9 +87,8 @@ static struct proc_dir_entry *pde_subdir_find(struct proc_dir_entry *dir,
|
|
static bool pde_subdir_insert(struct proc_dir_entry *dir,
|
|
static bool pde_subdir_insert(struct proc_dir_entry *dir,
|
|
struct proc_dir_entry *de)
|
|
struct proc_dir_entry *de)
|
|
{
|
|
{
|
|
- struct rb_root_cached *root = &dir->subdir;
|
|
|
|
- struct rb_node **new = &root->rb_root.rb_node, *parent = NULL;
|
|
|
|
- bool leftmost = true;
|
|
|
|
|
|
+ struct rb_root *root = &dir->subdir;
|
|
|
|
+ struct rb_node **new = &root->rb_node, *parent = NULL;
|
|
|
|
|
|
/* Figure out where to put new node */
|
|
/* Figure out where to put new node */
|
|
while (*new) {
|
|
while (*new) {
|
|
@@ -101,16 +100,15 @@ static bool pde_subdir_insert(struct proc_dir_entry *dir,
|
|
parent = *new;
|
|
parent = *new;
|
|
if (result < 0)
|
|
if (result < 0)
|
|
new = &(*new)->rb_left;
|
|
new = &(*new)->rb_left;
|
|
- else if (result > 0) {
|
|
|
|
|
|
+ else if (result > 0)
|
|
new = &(*new)->rb_right;
|
|
new = &(*new)->rb_right;
|
|
- leftmost = false;
|
|
|
|
- } else
|
|
|
|
|
|
+ else
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
/* Add new node and rebalance tree. */
|
|
/* Add new node and rebalance tree. */
|
|
rb_link_node(&de->subdir_node, parent, new);
|
|
rb_link_node(&de->subdir_node, parent, new);
|
|
- rb_insert_color_cached(&de->subdir_node, root, leftmost);
|
|
|
|
|
|
+ rb_insert_color(&de->subdir_node, root);
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -401,7 +399,7 @@ static struct proc_dir_entry *__proc_create(struct proc_dir_entry **parent,
|
|
ent->namelen = qstr.len;
|
|
ent->namelen = qstr.len;
|
|
ent->mode = mode;
|
|
ent->mode = mode;
|
|
ent->nlink = nlink;
|
|
ent->nlink = nlink;
|
|
- ent->subdir = RB_ROOT_CACHED;
|
|
|
|
|
|
+ ent->subdir = RB_ROOT;
|
|
refcount_set(&ent->refcnt, 1);
|
|
refcount_set(&ent->refcnt, 1);
|
|
spin_lock_init(&ent->pde_unload_lock);
|
|
spin_lock_init(&ent->pde_unload_lock);
|
|
INIT_LIST_HEAD(&ent->pde_openers);
|
|
INIT_LIST_HEAD(&ent->pde_openers);
|
|
@@ -577,7 +575,7 @@ void remove_proc_entry(const char *name, struct proc_dir_entry *parent)
|
|
|
|
|
|
de = pde_subdir_find(parent, fn, len);
|
|
de = pde_subdir_find(parent, fn, len);
|
|
if (de)
|
|
if (de)
|
|
- rb_erase_cached(&de->subdir_node, &parent->subdir);
|
|
|
|
|
|
+ rb_erase(&de->subdir_node, &parent->subdir);
|
|
write_unlock(&proc_subdir_lock);
|
|
write_unlock(&proc_subdir_lock);
|
|
if (!de) {
|
|
if (!de) {
|
|
WARN(1, "name '%s'\n", name);
|
|
WARN(1, "name '%s'\n", name);
|
|
@@ -614,13 +612,13 @@ int remove_proc_subtree(const char *name, struct proc_dir_entry *parent)
|
|
write_unlock(&proc_subdir_lock);
|
|
write_unlock(&proc_subdir_lock);
|
|
return -ENOENT;
|
|
return -ENOENT;
|
|
}
|
|
}
|
|
- rb_erase_cached(&root->subdir_node, &parent->subdir);
|
|
|
|
|
|
+ rb_erase(&root->subdir_node, &parent->subdir);
|
|
|
|
|
|
de = root;
|
|
de = root;
|
|
while (1) {
|
|
while (1) {
|
|
next = pde_subdir_first(de);
|
|
next = pde_subdir_first(de);
|
|
if (next) {
|
|
if (next) {
|
|
- rb_erase_cached(&next->subdir_node, &de->subdir);
|
|
|
|
|
|
+ rb_erase(&next->subdir_node, &de->subdir);
|
|
de = next;
|
|
de = next;
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|