diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2011-01-12 20:00:33 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 11:03:16 -0500 |
commit | 6d1b6e4eff89475785f60fa00f65da780f869f36 (patch) | |
tree | 41608a81f14b824c97b8d8f0849aff04bcf1f537 /fs/proc | |
parent | 9d6de12f70d2fb1487c4f482a21fed25fe74e0fd (diff) |
proc: ->low_ino cleanup
- ->low_ino is write-once field -- reading it under locks is unnecessary.
- /proc/$PID stuff never reaches pde_put()/free_proc_entry() --
PROC_DYNAMIC_FIRST check never triggers.
- in proc_get_inode(), inode number always matches proc dir entry, so
save one parameter.
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')
-rw-r--r-- | fs/proc/generic.c | 12 | ||||
-rw-r--r-- | fs/proc/inode.c | 7 | ||||
-rw-r--r-- | fs/proc/internal.h | 2 |
3 files changed, 6 insertions, 15 deletions
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index f766be29d2c7..d00c5af6f199 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -425,13 +425,10 @@ struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir, | |||
425 | if (de->namelen != dentry->d_name.len) | 425 | if (de->namelen != dentry->d_name.len) |
426 | continue; | 426 | continue; |
427 | if (!memcmp(dentry->d_name.name, de->name, de->namelen)) { | 427 | if (!memcmp(dentry->d_name.name, de->name, de->namelen)) { |
428 | unsigned int ino; | ||
429 | |||
430 | ino = de->low_ino; | ||
431 | pde_get(de); | 428 | pde_get(de); |
432 | spin_unlock(&proc_subdir_lock); | 429 | spin_unlock(&proc_subdir_lock); |
433 | error = -EINVAL; | 430 | error = -EINVAL; |
434 | inode = proc_get_inode(dir->i_sb, ino, de); | 431 | inode = proc_get_inode(dir->i_sb, de); |
435 | goto out_unlock; | 432 | goto out_unlock; |
436 | } | 433 | } |
437 | } | 434 | } |
@@ -768,12 +765,7 @@ EXPORT_SYMBOL(proc_create_data); | |||
768 | 765 | ||
769 | static void free_proc_entry(struct proc_dir_entry *de) | 766 | static void free_proc_entry(struct proc_dir_entry *de) |
770 | { | 767 | { |
771 | unsigned int ino = de->low_ino; | 768 | release_inode_number(de->low_ino); |
772 | |||
773 | if (ino < PROC_DYNAMIC_FIRST) | ||
774 | return; | ||
775 | |||
776 | release_inode_number(ino); | ||
777 | 769 | ||
778 | if (S_ISLNK(de->mode)) | 770 | if (S_ISLNK(de->mode)) |
779 | kfree(de->data); | 771 | kfree(de->data); |
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 6bcb926b101b..176ce4cda68a 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -416,12 +416,11 @@ static const struct file_operations proc_reg_file_ops_no_compat = { | |||
416 | }; | 416 | }; |
417 | #endif | 417 | #endif |
418 | 418 | ||
419 | struct inode *proc_get_inode(struct super_block *sb, unsigned int ino, | 419 | struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) |
420 | struct proc_dir_entry *de) | ||
421 | { | 420 | { |
422 | struct inode * inode; | 421 | struct inode * inode; |
423 | 422 | ||
424 | inode = iget_locked(sb, ino); | 423 | inode = iget_locked(sb, de->low_ino); |
425 | if (!inode) | 424 | if (!inode) |
426 | return NULL; | 425 | return NULL; |
427 | if (inode->i_state & I_NEW) { | 426 | if (inode->i_state & I_NEW) { |
@@ -471,7 +470,7 @@ int proc_fill_super(struct super_block *s) | |||
471 | s->s_time_gran = 1; | 470 | s->s_time_gran = 1; |
472 | 471 | ||
473 | pde_get(&proc_root); | 472 | pde_get(&proc_root); |
474 | root_inode = proc_get_inode(s, PROC_ROOT_INO, &proc_root); | 473 | root_inode = proc_get_inode(s, &proc_root); |
475 | if (!root_inode) | 474 | if (!root_inode) |
476 | goto out_no_root; | 475 | goto out_no_root; |
477 | root_inode->i_uid = 0; | 476 | root_inode->i_uid = 0; |
diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 659ea6af379a..9ad561ded409 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h | |||
@@ -109,7 +109,7 @@ void pde_put(struct proc_dir_entry *pde); | |||
109 | 109 | ||
110 | extern struct vfsmount *proc_mnt; | 110 | extern struct vfsmount *proc_mnt; |
111 | int proc_fill_super(struct super_block *); | 111 | int proc_fill_super(struct super_block *); |
112 | struct inode *proc_get_inode(struct super_block *, unsigned int, struct proc_dir_entry *); | 112 | struct inode *proc_get_inode(struct super_block *, struct proc_dir_entry *); |
113 | 113 | ||
114 | /* | 114 | /* |
115 | * These are generic /proc routines that use the internal | 115 | * These are generic /proc routines that use the internal |