From: Herbert Poetzl Subject: Re: [RFC][PATCH 07/27] sys_mkdirat(): collapse if() Date: Thu, 8 Jun 2006 12:46:50 +0200 Message-ID: <20060608104650.GE11996@MAIL.13thfloor.at> References: <20060608001013.0D041507@localhost.localdomain> <20060608001019.6ABD41A7@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, viro@ftp.linux.org.uk, hch@infradead.org, trond.myklebust@fys.uio.no Return-path: Received: from MAIL.13thfloor.at ([212.16.62.50]:31368 "EHLO mail.13thfloor.at") by vger.kernel.org with ESMTP id S964788AbWFHKqv (ORCPT ); Thu, 8 Jun 2006 06:46:51 -0400 To: Dave Hansen Content-Disposition: inline In-Reply-To: <20060608001019.6ABD41A7@localhost.localdomain> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org 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 > --- > > 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; > } > > _