From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sonic306-21.consmr.mail.gq1.yahoo.com ([98.137.68.84]:45572 "EHLO sonic306-21.consmr.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725968AbeJKGeL (ORCPT ); Thu, 11 Oct 2018 02:34:11 -0400 Subject: Re: [PATCH] clean erofs_lookup() To: Al Viro , linux-fsdevel@vger.kernel.org Cc: linux-erofs@lists.ozlabs.org, Greg Kroah-Hartman References: <20181010190116.GG32577@ZenIV.linux.org.uk> From: Gao Xiang Message-ID: Date: Thu, 11 Oct 2018 07:09:43 +0800 MIME-Version: 1.0 In-Reply-To: <20181010190116.GG32577@ZenIV.linux.org.uk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hi Alexander, On 2018/10/11 3:01, Al Viro wrote: > d_splice_alias() does the right thing when given > ERR_PTR(-E...) for inode. No need for gotos, multiple > returns, etc. in there. That is correct :) Thanks for your patch and attention. Once in the first version we used "d_add" rather than "d_splice_alias" because I think no need to support disconnect dentries / export in the near future. But We changed into "d_splice_alias" later, however it seems more redundant logics there... Reviewed-by: Gao Xiang Thanks, Gao Xiang > > Signed-off-by: Al Viro > --- > diff --git a/drivers/staging/erofs/namei.c b/drivers/staging/erofs/namei.c > index 546a47156101..8cf0617d4ea0 100644 > --- a/drivers/staging/erofs/namei.c > +++ b/drivers/staging/erofs/namei.c > @@ -223,18 +223,13 @@ static struct dentry *erofs_lookup(struct inode *dir, > if (err == -ENOENT) { > /* negative dentry */ > inode = NULL; > - goto negative_out; > - } else if (unlikely(err)) > - return ERR_PTR(err); > - > - debugln("%s, %s (nid %llu) found, d_type %u", __func__, > - dentry->d_name.name, nid, d_type); > - > - inode = erofs_iget(dir->i_sb, nid, d_type == EROFS_FT_DIR); > - if (IS_ERR(inode)) > - return ERR_CAST(inode); > - > -negative_out: > + } else if (unlikely(err)) { > + inode = ERR_PTR(err); > + } else { > + debugln("%s, %s (nid %llu) found, d_type %u", __func__, > + dentry->d_name.name, nid, d_type); > + inode = erofs_iget(dir->i_sb, nid, d_type == EROFS_FT_DIR); > + } > return d_splice_alias(inode, dentry); > } > >