]> err.no Git - linux-2.6/commitdiff
[patch 4/5] vfs: reuse local variable in vfs_link()
authorTetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Tue, 24 Jun 2008 14:50:15 +0000 (16:50 +0200)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 27 Jul 2008 00:53:17 +0000 (20:53 -0400)
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 <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
fs/namei.c

index 46af98ed136be9028a416ab8cb6c1d21954011d7..3b67be7631dc21b4d76bb4e2ee45b486eb0bb720 100644 (file)
@@ -2524,19 +2524,19 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
                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;
 }