Skip to contentSkip to conversation

kill walk_init_root

PATCH In review Christoph Hellwig 2 participants 2 messages Nov 5, 2008 – Nov 6, 2008 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kill walk_init_root

walk_init_root is a tiny helper that is marked __always_inline, has just one caller and an unused argument. Just merge it into the caller.

fs/namei.c +8 -13
Index: linux-2.6/fs/namei.c
===================================================================
@@ -521,18 +521,6 @@ out_unlock:
 	return result;
 }
 
-/* SMP-safe */
-static __always_inline void
-walk_init_root(const char *name, struct nameidata *nd)
-{
-	struct fs_struct *fs = current->fs;
-
-	read_lock(&fs->lock);
-	nd->path = fs->root;
-	path_get(&fs->root);
-	read_unlock(&fs->lock);
-}
-
 /*
  * Wrapper to retry pathname resolution whenever the underlying
  * file system returns an ESTALE.
@@ -570,9 +558,16 @@ static __always_inline int __vfs_follow_
 		goto fail;
 
 	if (*link == '/') {
+		struct fs_struct *fs = current->fs;
+
 		path_put(&nd->path);
-		walk_init_root(link, nd);
+
+		read_lock(&fs->lock);
+		nd->path = fs->root;
+		path_get(&fs->root);
+		read_unlock(&fs->lock);
 	}
+
 	res = link_path_walk(link, nd);
 	if (nd->depth || res || nd->last_type!=LAST_NORM)
 		return res;
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Christoph Hellwig

walk_init_root is a tiny helper that is marked __always_inline, has just one caller and an unused argument. Just merge it into the caller.

Looks good.

Quoted 48 lines

Index: linux-2.6/fs/namei.c
===================================================================

fs/namei.c +8 -14
@@ -521,18 +521,6 @@ out_unlock:
 	return result;
 }
 
-/* SMP-safe */
-static __always_inline void
-walk_init_root(const char *name, struct nameidata *nd)
-{
-	struct fs_struct *fs = current->fs;
-
-	read_lock(&fs->lock);
-	nd->path = fs->root;
-	path_get(&fs->root);
-	read_unlock(&fs->lock);
-}
-
 /*
  * Wrapper to retry pathname resolution whenever the underlying
  * file system returns an ESTALE.
@@ -570,9 +558,16 @@ static __always_inline int __vfs_follow_
 		goto fail;
 
 	if (*link == '/') {
+		struct fs_struct *fs = current->fs;
+
 		path_put(&nd->path);
-		walk_init_root(link, nd);
+
+		read_lock(&fs->lock);
+		nd->path = fs->root;
+		path_get(&fs->root);
+		read_unlock(&fs->lock);
 	}
+
 	res = link_path_walk(link, nd);
 	if (nd->depth || res || nd->last_type!=LAST_NORM)
 		return res;
--

To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html