mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: viro@ZenIV.linux.org.uk
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	hch@infradead.org, akpm@linux-foundation.org,
	Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Subject: [patch 4/5] vfs: reuse local variable in vfs_link()
Date: Tue, 24 Jun 2008 16:50:15 +0200	[thread overview]
Message-ID: <20080624145046.609698202@szeredi.hu> (raw)
In-Reply-To: <20080624145011.722691277@szeredi.hu>

[-- Attachment #1: vfs-reuse-local-variable-in-vfs_link.patch --]
[-- Type: text/plain, Size: 1293 bytes --]

From: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>

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 |    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;
 }
 

--

  parent reply	other threads:[~2008-06-24 14:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-24 14:50 [patch 0/5] vfs: cleanups Miklos Szeredi
2008-06-24 14:50 ` [patch 1/5] vfs: truncate: dont check immutable twice Miklos Szeredi
2008-06-24 14:50 ` [patch 2/5] vfs: create file_truncate() helper Miklos Szeredi
2008-06-24 14:50 ` [patch 3/5] vfs: change remove_suid() to file_remove_suid() Miklos Szeredi
2008-06-24 14:50 ` Miklos Szeredi [this message]
2008-06-24 14:50 ` [patch 5/5] vfs: remove mode parameter from vfs_symlink() Miklos Szeredi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080624145046.609698202@szeredi.hu \
    --to=miklos@szeredi.hu \
    --cc=akpm@linux-foundation.org \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®