diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2009-12-15 16:45:39 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 07:19:57 -0800 |
commit | 135d5655dc58a24eda64e3f6c192d7d605e10050 (patch) | |
tree | 4851018ab64c1173059198dde42501cc615886b4 /fs/proc/generic.c | |
parent | f065f41f48569122b5bcddbd1ba2354f7cc29fdc (diff) | |
download | talos-op-linux-135d5655dc58a24eda64e3f6c192d7d605e10050.tar.gz talos-op-linux-135d5655dc58a24eda64e3f6c192d7d605e10050.zip |
proc: rename de_get() to pde_get() and inline it
* de_get() is trivial -- make inline, save a few bits of code, drop
"refcount is 0" check -- it should be done in some generic refcount
code, don't recall it's was helpful
* rename GET and PUT functions to pde_get(), pde_put() for cool prefix!
* remove obvious and incorrent comments
* in remove_proc_entry() use pde_put(), when I fixed PDE refcounting to
be normal one, remove_proc_entry() was supposed to do "-1" and code now
reflects that.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc/generic.c')
-rw-r--r-- | fs/proc/generic.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index fa678abc9db1..480cb1065eec 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c @@ -429,7 +429,7 @@ struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir, unsigned int ino; ino = de->low_ino; - de_get(de); + pde_get(de); spin_unlock(&proc_subdir_lock); error = -EINVAL; inode = proc_get_inode(dir->i_sb, ino, de); @@ -445,7 +445,7 @@ out_unlock: return NULL; } if (de) - de_put(de); + pde_put(de); return ERR_PTR(error); } @@ -509,17 +509,17 @@ int proc_readdir_de(struct proc_dir_entry *de, struct file *filp, void *dirent, struct proc_dir_entry *next; /* filldir passes info to user space */ - de_get(de); + pde_get(de); spin_unlock(&proc_subdir_lock); if (filldir(dirent, de->name, de->namelen, filp->f_pos, de->low_ino, de->mode >> 12) < 0) { - de_put(de); + pde_put(de); goto out; } spin_lock(&proc_subdir_lock); filp->f_pos++; next = de->next; - de_put(de); + pde_put(de); de = next; } while (de); spin_unlock(&proc_subdir_lock); @@ -763,7 +763,7 @@ out: return NULL; } -void free_proc_entry(struct proc_dir_entry *de) +static void free_proc_entry(struct proc_dir_entry *de) { unsigned int ino = de->low_ino; @@ -777,6 +777,12 @@ void free_proc_entry(struct proc_dir_entry *de) kfree(de); } +void pde_put(struct proc_dir_entry *pde) +{ + if (atomic_dec_and_test(&pde->count)) + free_proc_entry(pde); +} + /* * Remove a /proc entry and free it if it's not currently in use. */ @@ -845,6 +851,5 @@ continue_removing: WARN(de->subdir, KERN_WARNING "%s: removing non-empty directory " "'%s/%s', leaking at least '%s'\n", __func__, de->parent->name, de->name, de->subdir->name); - if (atomic_dec_and_test(&de->count)) - free_proc_entry(de); + pde_put(de); } |