diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2012-05-31 19:26:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-31 20:49:29 -0400 |
commit | af5e6171437c9d62d84459b24877c94c23782676 (patch) | |
tree | 06ee8cef7f47a0f4facd84f7676c39001965e549 /fs/proc | |
parent | f05ed3f1abefd37c08fbf08c766d2abd40607777 (diff) |
proc: pass "fd" by value in /proc/*/{fd,fdinfo} code
Pass "fd" directly, not via pointer -- one less memory read.
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/base.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 0f928cbba4a4..bd8b4ca6a610 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1848,7 +1848,7 @@ static const struct dentry_operations tid_fd_dentry_operations = | |||
1848 | static struct dentry *proc_fd_instantiate(struct inode *dir, | 1848 | static struct dentry *proc_fd_instantiate(struct inode *dir, |
1849 | struct dentry *dentry, struct task_struct *task, const void *ptr) | 1849 | struct dentry *dentry, struct task_struct *task, const void *ptr) |
1850 | { | 1850 | { |
1851 | unsigned fd = *(const unsigned *)ptr; | 1851 | unsigned fd = (unsigned long)ptr; |
1852 | struct inode *inode; | 1852 | struct inode *inode; |
1853 | struct proc_inode *ei; | 1853 | struct proc_inode *ei; |
1854 | struct dentry *error = ERR_PTR(-ENOENT); | 1854 | struct dentry *error = ERR_PTR(-ENOENT); |
@@ -1885,7 +1885,7 @@ static struct dentry *proc_lookupfd_common(struct inode *dir, | |||
1885 | if (fd == ~0U) | 1885 | if (fd == ~0U) |
1886 | goto out; | 1886 | goto out; |
1887 | 1887 | ||
1888 | result = instantiate(dir, dentry, task, &fd); | 1888 | result = instantiate(dir, dentry, task, (void *)(unsigned long)fd); |
1889 | out: | 1889 | out: |
1890 | put_task_struct(task); | 1890 | put_task_struct(task); |
1891 | out_no_task: | 1891 | out_no_task: |
@@ -1937,7 +1937,7 @@ static int proc_readfd_common(struct file * filp, void * dirent, | |||
1937 | len = snprintf(name, sizeof(name), "%d", fd); | 1937 | len = snprintf(name, sizeof(name), "%d", fd); |
1938 | rv = proc_fill_cache(filp, dirent, filldir, | 1938 | rv = proc_fill_cache(filp, dirent, filldir, |
1939 | name, len, instantiate, p, | 1939 | name, len, instantiate, p, |
1940 | &fd); | 1940 | (void *)(unsigned long)fd); |
1941 | if (rv < 0) | 1941 | if (rv < 0) |
1942 | goto out_fd_loop; | 1942 | goto out_fd_loop; |
1943 | rcu_read_lock(); | 1943 | rcu_read_lock(); |
@@ -2353,7 +2353,7 @@ static const struct inode_operations proc_fd_inode_operations = { | |||
2353 | static struct dentry *proc_fdinfo_instantiate(struct inode *dir, | 2353 | static struct dentry *proc_fdinfo_instantiate(struct inode *dir, |
2354 | struct dentry *dentry, struct task_struct *task, const void *ptr) | 2354 | struct dentry *dentry, struct task_struct *task, const void *ptr) |
2355 | { | 2355 | { |
2356 | unsigned fd = *(unsigned *)ptr; | 2356 | unsigned fd = (unsigned long)ptr; |
2357 | struct inode *inode; | 2357 | struct inode *inode; |
2358 | struct proc_inode *ei; | 2358 | struct proc_inode *ei; |
2359 | struct dentry *error = ERR_PTR(-ENOENT); | 2359 | struct dentry *error = ERR_PTR(-ENOENT); |