diff mbox

[V9fs-developer] 9p: proper use of the 'name' variable

Message ID 1380411144-9236-8-git-send-email-geyslan@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Geyslan G. Bem Sept. 28, 2013, 11:32 p.m. UTC
The 'name' variable was assigned but never used. Hence puts its
assignment to the top and makes proper use of its value.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
---
 fs/9p/vfs_inode_dotl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Eric Van Hensbergen Oct. 20, 2013, 8:59 p.m. UTC | #1
I reckon we should probably just get rid of name if its not being used.  I
doubt the indirection is going to hurt anything here.

     -eric



On Sat, Sep 28, 2013 at 6:32 PM, Geyslan G. Bem <geyslan@gmail.com> wrote:

> The 'name' variable was assigned but never used. Hence puts its
> assignment to the top and makes proper use of its value.
>
> Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
> ---
>  fs/9p/vfs_inode_dotl.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
> index 6803758..86b6944 100644
> --- a/fs/9p/vfs_inode_dotl.c
> +++ b/fs/9p/vfs_inode_dotl.c
> @@ -772,8 +772,10 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct
> inode *dir,
>         struct p9_fid *dfid, *oldfid;
>         struct v9fs_session_info *v9ses;
>
> +       name = (char *) dentry->d_name.name;
> +
>         p9_debug(P9_DEBUG_VFS, "dir ino: %lu, old_name: %s, new_name:
> %s\n",
> -                dir->i_ino, old_dentry->d_name.name, dentry->d_name.name
> );
> +                dir->i_ino, old_dentry->d_name.name, name);
>
>         v9ses = v9fs_inode2v9ses(dir);
>         dir_dentry = dentry->d_parent;
> @@ -785,9 +787,7 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct
> inode *dir,
>         if (IS_ERR(oldfid))
>                 return PTR_ERR(oldfid);
>
> -       name = (char *) dentry->d_name.name;
> -
> -       err = p9_client_link(dfid, oldfid, (char *)dentry->d_name.name);
> +       err = p9_client_link(dfid, oldfid, name);
>
>         if (err < 0) {
>                 p9_debug(P9_DEBUG_VFS, "p9_client_link failed %d\n", err);
> --
> 1.8.4
>
>
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
Geyslan G. Bem Oct. 21, 2013, 10:53 a.m. UTC | #2
2013/10/20 Eric Van Hensbergen <ericvh@gmail.com>:
> I reckon we should probably just get rid of name if its not being used.  I
> doubt the indirection is going to hurt anything here.
>
>      -eric
>

Eric, you're right. Once that there's not assignment to name, the
cycles are the same.
I'll get rid of name var.

>
>
> On Sat, Sep 28, 2013 at 6:32 PM, Geyslan G. Bem <geyslan@gmail.com> wrote:
>>
>> The 'name' variable was assigned but never used. Hence puts its
>> assignment to the top and makes proper use of its value.
>>
>> Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
>> ---
>>  fs/9p/vfs_inode_dotl.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
>> index 6803758..86b6944 100644
>> --- a/fs/9p/vfs_inode_dotl.c
>> +++ b/fs/9p/vfs_inode_dotl.c
>> @@ -772,8 +772,10 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct
>> inode *dir,
>>         struct p9_fid *dfid, *oldfid;
>>         struct v9fs_session_info *v9ses;
>>
>> +       name = (char *) dentry->d_name.name;
>> +
>>         p9_debug(P9_DEBUG_VFS, "dir ino: %lu, old_name: %s, new_name:
>> %s\n",
>> -                dir->i_ino, old_dentry->d_name.name,
>> dentry->d_name.name);
>> +                dir->i_ino, old_dentry->d_name.name, name);
>>
>>         v9ses = v9fs_inode2v9ses(dir);
>>         dir_dentry = dentry->d_parent;
>> @@ -785,9 +787,7 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct
>> inode *dir,
>>         if (IS_ERR(oldfid))
>>                 return PTR_ERR(oldfid);
>>
>> -       name = (char *) dentry->d_name.name;
>> -
>> -       err = p9_client_link(dfid, oldfid, (char *)dentry->d_name.name);
>> +       err = p9_client_link(dfid, oldfid, name);
>>
>>         if (err < 0) {
>>                 p9_debug(P9_DEBUG_VFS, "p9_client_link failed %d\n", err);
>> --
>> 1.8.4
>>
>

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
Geyslan G. Bem Oct. 21, 2013, 7 p.m. UTC | #3
2013/10/21 Geyslan Gregório Bem <geyslan@gmail.com>:
> 2013/10/20 Eric Van Hensbergen <ericvh@gmail.com>:
>> I reckon we should probably just get rid of name if its not being used.  I
>> doubt the indirection is going to hurt anything here.
>>
>>      -eric
>>
>
> Eric, you're right. Once that there's not assignment to name, the
> cycles are the same.
> I'll get rid of name var.
>

New patch sent.
[PATCH] 9p: remove useless 'name' variable and assignment

>>
>>
>> On Sat, Sep 28, 2013 at 6:32 PM, Geyslan G. Bem <geyslan@gmail.com> wrote:
>>>
>>> The 'name' variable was assigned but never used. Hence puts its
>>> assignment to the top and makes proper use of its value.
>>>
>>> Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
>>> ---
>>>  fs/9p/vfs_inode_dotl.c | 8 ++++----
>>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
>>> index 6803758..86b6944 100644
>>> --- a/fs/9p/vfs_inode_dotl.c
>>> +++ b/fs/9p/vfs_inode_dotl.c
>>> @@ -772,8 +772,10 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct
>>> inode *dir,
>>>         struct p9_fid *dfid, *oldfid;
>>>         struct v9fs_session_info *v9ses;
>>>
>>> +       name = (char *) dentry->d_name.name;
>>> +
>>>         p9_debug(P9_DEBUG_VFS, "dir ino: %lu, old_name: %s, new_name:
>>> %s\n",
>>> -                dir->i_ino, old_dentry->d_name.name,
>>> dentry->d_name.name);
>>> +                dir->i_ino, old_dentry->d_name.name, name);
>>>
>>>         v9ses = v9fs_inode2v9ses(dir);
>>>         dir_dentry = dentry->d_parent;
>>> @@ -785,9 +787,7 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct
>>> inode *dir,
>>>         if (IS_ERR(oldfid))
>>>                 return PTR_ERR(oldfid);
>>>
>>> -       name = (char *) dentry->d_name.name;
>>> -
>>> -       err = p9_client_link(dfid, oldfid, (char *)dentry->d_name.name);
>>> +       err = p9_client_link(dfid, oldfid, name);
>>>
>>>         if (err < 0) {
>>>                 p9_debug(P9_DEBUG_VFS, "p9_client_link failed %d\n", err);
>>> --
>>> 1.8.4
>>>
>>

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
diff mbox

Patch

diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 6803758..86b6944 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -772,8 +772,10 @@  v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
 	struct p9_fid *dfid, *oldfid;
 	struct v9fs_session_info *v9ses;
 
+	name = (char *) dentry->d_name.name;
+
 	p9_debug(P9_DEBUG_VFS, "dir ino: %lu, old_name: %s, new_name: %s\n",
-		 dir->i_ino, old_dentry->d_name.name, dentry->d_name.name);
+		 dir->i_ino, old_dentry->d_name.name, name);
 
 	v9ses = v9fs_inode2v9ses(dir);
 	dir_dentry = dentry->d_parent;
@@ -785,9 +787,7 @@  v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
 	if (IS_ERR(oldfid))
 		return PTR_ERR(oldfid);
 
-	name = (char *) dentry->d_name.name;
-
-	err = p9_client_link(dfid, oldfid, (char *)dentry->d_name.name);
+	err = p9_client_link(dfid, oldfid, name);
 
 	if (err < 0) {
 		p9_debug(P9_DEBUG_VFS, "p9_client_link failed %d\n", err);