2007-05-05 23:01:55

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 0/2] [TRIVIAL] Small cleanups for do_path_lookup

The following 2 patches are trivial cleanups to do_path_lookup in namei.c.
Since these changes are trivial, they can go into 2.6.22-rc1 without any
problems.

Josef 'Jeff' Sipek (2):
fs: Fix indentation in do_path_lookup
fs: Use path_walk in do_path_lookup

diffstat for good measure:

fs/namei.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

Josef 'Jeff' Sipek.

[email protected]



2007-05-05 23:02:04

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 1/2] fs: Fix indentation in do_path_lookup

Signed-off-by: Josef 'Jeff' Sipek <[email protected]>
---
fs/namei.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 0262594..600a4e7 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1159,7 +1159,7 @@ out:
if (likely(retval == 0)) {
if (unlikely(!audit_dummy_context() && nd && nd->dentry &&
nd->dentry->d_inode))
- audit_inode(name, nd->dentry->d_inode);
+ audit_inode(name, nd->dentry->d_inode);
}
out_fail:
return retval;
--
1.5.0.3.1043.g4342

2007-05-05 23:03:06

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH 2/2] fs: Use path_walk in do_path_lookup

Since, path_walk sets the total_link_count to 0, and calls link_path_walk,
we can just call path_walk directly.

Signed-off-by: Josef 'Jeff' Sipek <[email protected]>
---
fs/namei.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 600a4e7..86f0def 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1153,8 +1153,8 @@ static int fastcall do_path_lookup(int dfd, const char *name,

fput_light(file, fput_needed);
}
- current->total_link_count = 0;
- retval = link_path_walk(name, nd);
+
+ retval = path_walk(name, nd);
out:
if (likely(retval == 0)) {
if (unlikely(!audit_dummy_context() && nd && nd->dentry &&
--
1.5.0.3.1043.g4342

2007-05-06 11:11:32

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH 1/2] fs: Fix indentation in do_path_lookup

On Sat, May 05, 2007 at 06:59:39PM -0400, Josef 'Jeff' Sipek wrote:
> Signed-off-by: Josef 'Jeff' Sipek <[email protected]>
> ---
> fs/namei.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/fs/namei.c b/fs/namei.c
> index 0262594..600a4e7 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -1159,7 +1159,7 @@ out:
> if (likely(retval == 0)) {
> if (unlikely(!audit_dummy_context() && nd && nd->dentry &&
> nd->dentry->d_inode))
> - audit_inode(name, nd->dentry->d_inode);
> + audit_inode(name, nd->dentry->d_inode);
> }

Actually this area should get some more changes. There should be no
likely retval == 0 branch because it only contains another branch, and
nd is guaranteed to be zero.

So it should become:

if (unlikely(!retval && !audit_dummy_context() &&
nd->dentry && nd->dentry->d_inode))
audit_inode(name, nd->dentry->d_inode);

2007-05-06 11:11:46

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH 2/2] fs: Use path_walk in do_path_lookup

On Sat, May 05, 2007 at 06:59:40PM -0400, Josef 'Jeff' Sipek wrote:
> Since, path_walk sets the total_link_count to 0, and calls link_path_walk,
> we can just call path_walk directly.

Ok.

2007-05-06 15:30:42

by Josef 'Jeff' Sipek

[permalink] [raw]
Subject: [PATCH] fs: Fix indentation in do_path_lookup

Signed-off-by: Josef 'Jeff' Sipek <[email protected]>
---
fs/namei.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 0262594..48078ea 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1156,11 +1156,9 @@ static int fastcall do_path_lookup(int dfd, const char *name,
current->total_link_count = 0;
retval = link_path_walk(name, nd);
out:
- if (likely(retval == 0)) {
- if (unlikely(!audit_dummy_context() && nd && nd->dentry &&
- nd->dentry->d_inode))
+ if (unlikely(!retval && !audit_dummy_context() && nd &&
+ nd->dentry && nd->dentry->d_inode))
audit_inode(name, nd->dentry->d_inode);
- }
out_fail:
return retval;

--
1.5.2.rc1.20.g86b9

2007-05-06 16:21:26

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] fs: Fix indentation in do_path_lookup

On Sun, May 06, 2007 at 11:30:28AM -0400, Josef 'Jeff' Sipek wrote:
> + if (unlikely(!retval && !audit_dummy_context() && nd &&
> + nd->dentry && nd->dentry->d_inode))

the check for nd is not needed either as I hopefully mentioned in my
last mail.

2007-05-06 16:43:42

by Josef Sipek

[permalink] [raw]
Subject: Re: [PATCH 1/2] fs: Fix indentation in do_path_lookup

On Sun, May 06, 2007 at 12:11:24PM +0100, Christoph Hellwig wrote:
> On Sat, May 05, 2007 at 06:59:39PM -0400, Josef 'Jeff' Sipek wrote:
> > Signed-off-by: Josef 'Jeff' Sipek <[email protected]>
> > ---
> > fs/namei.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/fs/namei.c b/fs/namei.c
> > index 0262594..600a4e7 100644
> > --- a/fs/namei.c
> > +++ b/fs/namei.c
> > @@ -1159,7 +1159,7 @@ out:
> > if (likely(retval == 0)) {
> > if (unlikely(!audit_dummy_context() && nd && nd->dentry &&
> > nd->dentry->d_inode))
> > - audit_inode(name, nd->dentry->d_inode);
> > + audit_inode(name, nd->dentry->d_inode);
> > }
...
> nd is guaranteed to be zero.

Should that say non-zero?


Josef "Jeff" Sipek.

--
Humans were created by water to transport it upward.

2007-05-06 16:49:57

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH 1/2] fs: Fix indentation in do_path_lookup

On Sun, May 06, 2007 at 12:43:23PM -0400, Josef Sipek wrote:
> On Sun, May 06, 2007 at 12:11:24PM +0100, Christoph Hellwig wrote:
> > On Sat, May 05, 2007 at 06:59:39PM -0400, Josef 'Jeff' Sipek wrote:
> > > Signed-off-by: Josef 'Jeff' Sipek <[email protected]>
> > > ---
> > > fs/namei.c | 2 +-
> > > 1 files changed, 1 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/fs/namei.c b/fs/namei.c
> > > index 0262594..600a4e7 100644
> > > --- a/fs/namei.c
> > > +++ b/fs/namei.c
> > > @@ -1159,7 +1159,7 @@ out:
> > > if (likely(retval == 0)) {
> > > if (unlikely(!audit_dummy_context() && nd && nd->dentry &&
> > > nd->dentry->d_inode))
> > > - audit_inode(name, nd->dentry->d_inode);
> > > + audit_inode(name, nd->dentry->d_inode);
> > > }
> ...
> > nd is guaranteed to be zero.
>
> Should that say non-zero?

Yes, sorry.