Re: [git patch] vfs: permission API cleanup (v2)

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Miklos Szeredi <miklos@...>
Cc: <hch@...>, <viro@...>, <trond.myklebust@...>, <linux-kernel@...>, <linux-fsdevel@...>
Date: Friday, May 23, 2008 - 12:30 am

Subject: Reuse local variable in vfs_link().

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>
---
 fs/namei.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- vfs.orig/fs/namei.c
+++ vfs/fs/namei.c
@@ -2554,19 +2554,19 @@ static int vfs_link(struct dentry *old_d
 		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;
 }
 
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[git patch] vfs: permission API cleanup (v2), Miklos Szeredi, (Thu May 22, 12:49 pm)
Re: [git patch] vfs: permission API cleanup (v2), Tetsuo Handa, (Sat May 24, 12:04 am)
Re: [git patch] vfs: permission API cleanup (v2), Tetsuo Handa, (Fri May 23, 12:30 am)
Re: [git patch] vfs: permission API cleanup (v2), Tetsuo Handa, (Fri May 23, 12:00 am)
Re: [git patch] vfs: permission API cleanup (v2), Miklos Szeredi, (Fri May 23, 2:40 am)
Re: [git patch] vfs: permission API cleanup (v2), Tetsuo Handa, (Fri May 23, 3:02 am)