linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kill walk_init_root
@ 2008-11-05 14:07 Christoph Hellwig
  2008-11-06  3:18 ` Timothy Shimmin
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2008-11-05 14:07 UTC (permalink / raw)
  To: viro; +Cc: linux-fsdevel

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.


Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/fs/namei.c
===================================================================
--- linux-2.6.orig/fs/namei.c	2008-11-04 12:24:53.000000000 +0100
+++ linux-2.6/fs/namei.c	2008-11-04 12:26:04.000000000 +0100
@@ -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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] kill walk_init_root
  2008-11-05 14:07 [PATCH] kill walk_init_root Christoph Hellwig
@ 2008-11-06  3:18 ` Timothy Shimmin
  0 siblings, 0 replies; 2+ messages in thread
From: Timothy Shimmin @ 2008-11-06  3:18 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: viro, linux-fsdevel

Christoph Hellwig wrote:
> 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.

Reviewed-by: Tim Shimmin <tes@sgi.com>
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Index: linux-2.6/fs/namei.c
> ===================================================================
> --- linux-2.6.orig/fs/namei.c	2008-11-04 12:24:53.000000000 +0100
> +++ linux-2.6/fs/namei.c	2008-11-04 12:26:04.000000000 +0100
> @@ -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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-06  3:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-05 14:07 [PATCH] kill walk_init_root Christoph Hellwig
2008-11-06  3:18 ` Timothy Shimmin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).