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>
This commit is contained in:
parent
f05ed3f1ab
commit
af5e617143
|
@ -1848,7 +1848,7 @@ static const struct dentry_operations tid_fd_dentry_operations =
|
||||||
static struct dentry *proc_fd_instantiate(struct inode *dir,
|
static struct dentry *proc_fd_instantiate(struct inode *dir,
|
||||||
struct dentry *dentry, struct task_struct *task, const void *ptr)
|
struct dentry *dentry, struct task_struct *task, const void *ptr)
|
||||||
{
|
{
|
||||||
unsigned fd = *(const unsigned *)ptr;
|
unsigned fd = (unsigned long)ptr;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
struct proc_inode *ei;
|
struct proc_inode *ei;
|
||||||
struct dentry *error = ERR_PTR(-ENOENT);
|
struct dentry *error = ERR_PTR(-ENOENT);
|
||||||
|
@ -1885,7 +1885,7 @@ static struct dentry *proc_lookupfd_common(struct inode *dir,
|
||||||
if (fd == ~0U)
|
if (fd == ~0U)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
result = instantiate(dir, dentry, task, &fd);
|
result = instantiate(dir, dentry, task, (void *)(unsigned long)fd);
|
||||||
out:
|
out:
|
||||||
put_task_struct(task);
|
put_task_struct(task);
|
||||||
out_no_task:
|
out_no_task:
|
||||||
|
@ -1937,7 +1937,7 @@ static int proc_readfd_common(struct file * filp, void * dirent,
|
||||||
len = snprintf(name, sizeof(name), "%d", fd);
|
len = snprintf(name, sizeof(name), "%d", fd);
|
||||||
rv = proc_fill_cache(filp, dirent, filldir,
|
rv = proc_fill_cache(filp, dirent, filldir,
|
||||||
name, len, instantiate, p,
|
name, len, instantiate, p,
|
||||||
&fd);
|
(void *)(unsigned long)fd);
|
||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
goto out_fd_loop;
|
goto out_fd_loop;
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
|
@ -2353,7 +2353,7 @@ static const struct inode_operations proc_fd_inode_operations = {
|
||||||
static struct dentry *proc_fdinfo_instantiate(struct inode *dir,
|
static struct dentry *proc_fdinfo_instantiate(struct inode *dir,
|
||||||
struct dentry *dentry, struct task_struct *task, const void *ptr)
|
struct dentry *dentry, struct task_struct *task, const void *ptr)
|
||||||
{
|
{
|
||||||
unsigned fd = *(unsigned *)ptr;
|
unsigned fd = (unsigned long)ptr;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
struct proc_inode *ei;
|
struct proc_inode *ei;
|
||||||
struct dentry *error = ERR_PTR(-ENOENT);
|
struct dentry *error = ERR_PTR(-ENOENT);
|
||||||
|
|
Reference in New Issue