Re: [RFC][PATCH 07/27] sys_mkdirat(): collapse if()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 07, 2006 at 05:10:19PM -0700, Dave Hansen wrote:
> 
> Take the entire "if (IS_ERR(tmp))" block, and use a goto,
> instead.
> 
> This should not make any functional changes.

AFAICR, my test tool was done before the *at funtions
were added to the kernel. did you extend it or test
them in addition to the normal tests?

best,
Herbert

> Signed-off-by: Dave Hansen <haveblue@xxxxxxxxxx>
> ---
> 
>  lxc-dave/fs/namei.c |   38 +++++++++++++++++++-------------------
>  1 files changed, 19 insertions(+), 19 deletions(-)
> 
> diff -puN fs/namei.c~sys_mkdir_at-move-cases fs/namei.c
> --- lxc/fs/namei.c~sys_mkdir_at-move-cases	2006-06-07 16:53:16.000000000 -0700
> +++ lxc-dave/fs/namei.c	2006-06-07 16:53:16.000000000 -0700
> @@ -1888,30 +1888,30 @@ asmlinkage long sys_mkdirat(int dfd, con
>  {
>  	int error = 0;
>  	char * tmp;
> +	struct dentry *dentry;
> +	struct nameidata nd;
>  
>  	tmp = getname(pathname);
>  	error = PTR_ERR(tmp);
> -	if (!IS_ERR(tmp)) {
> -		struct dentry *dentry;
> -		struct nameidata nd;
> +	if (IS_ERR(tmp))
> +		goto out_err;
>  
> -		error = do_path_lookup(dfd, tmp, LOOKUP_PARENT, &nd);
> -		if (error)
> -			goto out;
> -		dentry = lookup_create(&nd, 1);
> -		error = PTR_ERR(dentry);
> -		if (!IS_ERR(dentry)) {
> -			if (!IS_POSIXACL(nd.dentry->d_inode))
> -				mode &= ~current->fs->umask;
> -			error = vfs_mkdir(nd.dentry->d_inode, dentry, mode);
> -			dput(dentry);
> -		}
> -		mutex_unlock(&nd.dentry->d_inode->i_mutex);
> -		path_release(&nd);
> -out:
> -		putname(tmp);
> +	error = do_path_lookup(dfd, tmp, LOOKUP_PARENT, &nd);
> +	if (error)
> +		goto out;
> +	dentry = lookup_create(&nd, 1);
> +	error = PTR_ERR(dentry);
> +	if (!IS_ERR(dentry)) {
> +		if (!IS_POSIXACL(nd.dentry->d_inode))
> +			mode &= ~current->fs->umask;
> +		error = vfs_mkdir(nd.dentry->d_inode, dentry, mode);
> +		dput(dentry);
>  	}
> -
> +	mutex_unlock(&nd.dentry->d_inode->i_mutex);
> +	path_release(&nd);
> +out:
> +	putname(tmp);
> +out_err:
>  	return error;
>  }
>  
> _
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux