2008-06-24 14:52:01

by Miklos Szeredi

[permalink] [raw]
Subject: [patch 4/5] vfs: reuse local variable in vfs_link()

From: Tetsuo Handa <[email protected]>

Why not reuse "inode" which is assigned as

struct inode *inode = old_dentry->d_inode;

in the beginning of vfs_link() ?

Signed-off-by: Tetsuo Handa <[email protected]>
Signed-off-by: Miklos Szeredi <[email protected]>
---
fs/namei.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6/fs/namei.c
===================================================================
--- linux-2.6.orig/fs/namei.c 2008-06-24 16:13:32.000000000 +0200
+++ linux-2.6/fs/namei.c 2008-06-24 16:26:00.000000000 +0200
@@ -2498,19 +2498,19 @@ int vfs_link(struct dentry *old_dentry,
return -EPERM;
if (!dir->i_op || !dir->i_op->link)
return -EPERM;
- if (S_ISDIR(old_dentry->d_inode->i_mode))
+ if (S_ISDIR(inode->i_mode))
return -EPERM;

error = security_inode_link(old_dentry, dir, new_dentry);
if (error)
return error;

- mutex_lock(&old_dentry->d_inode->i_mutex);
+ mutex_lock(&inode->i_mutex);
DQUOT_INIT(dir);
error = dir->i_op->link(old_dentry, dir, new_dentry);
- mutex_unlock(&old_dentry->d_inode->i_mutex);
+ mutex_unlock(&inode->i_mutex);
if (!error)
- fsnotify_link(dir, old_dentry->d_inode, new_dentry);
+ fsnotify_link(dir, inode, new_dentry);
return error;
}


--