Skip to contentSkip to conversation

Small cleanups for do_path_lookup

PATCH In review Josef 'Jeff' Sipek 3 participants 9 messages May 5, 2007 – May 6, 2007 VFS

lore
Share & tools
lore
#0 lore raw

cover 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]

#1 lore raw

PATCH 1/2 fs: Fix indentation in do_path_lookup

---
 fs/namei.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/namei.c +1 -1
index 0262594..600a4e7 100644
@@ -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;
Signature · 1 line
1.5.0.3.1043.g4342
#2 lore raw

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

Quoted 10 lines · Josef 'Jeff' Sipek
---
 fs/namei.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/namei.c +0 -0
index 0262594..600a4e7 100644

fs/namei.c out: · line 1163

Quoted 6 lines
fs/namei.c +1 -1
@@ -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);
#3 lore raw

PATCH 1/1 fs: Fix indentation in do_path_lookup

---
 fs/namei.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
fs/namei.c +2 -4
index 0262594..48078ea 100644
@@ -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;
 
Signature · 1 line
1.5.2.rc1.20.g86b9
#4 lore raw

Re: [PATCH] fs: Fix indentation in do_path_lookup

fs/namei.c static int fastcall do_path_lookup(int dfd, const char *name, · line 1160

Quoted 2 lines · Josef 'Jeff' Sipek
fs/namei.c +2 -0
+	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.

#5 lore raw

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

In reply to Christoph Hellwig
Quoted 17 lines · Christoph Hellwig
Quoted 16 lines · Josef 'Jeff' Sipek
---
 fs/namei.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/namei.c +1 -1
index 0262594..600a4e7 100644
@@ -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);
 	}

...

Quoted 1 line

nd is guaranteed to be zero.

Should that say non-zero?

Josef "Jeff" Sipek.

Signature · 1 line
Humans were created by water to transport it upward.
#6 lore raw

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

Quoted 19 lines · Josef Sipek
Quoted 17 lines · Christoph Hellwig
Quoted 16 lines · Josef 'Jeff' Sipek
---
 fs/namei.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/namei.c +1 -1
index 0262594..600a4e7 100644
@@ -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);
 	}

...

Quoted 3 lines
Quoted 1 line

nd is guaranteed to be zero.

Should that say non-zero?

Yes, sorry.

#7 lore raw

PATCH 2/2 fs: Use path_walk in do_path_lookup

In reply to Josef 'Jeff' Sipek

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

---
 fs/namei.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/namei.c +2 -2
index 600a4e7..86f0def 100644
@@ -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 &&
Signature · 1 line
1.5.0.3.1043.g4342
#8 lore raw

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

Quoted 2 lines · Josef 'Jeff' Sipek

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

Ok.