From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zeniv.linux.org.uk ([195.92.253.2]:41100 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751984AbeEMVaU (ORCPT ); Sun, 13 May 2018 17:30:20 -0400 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: "Darrick J . Wong" Subject: [PATCH 14/15] xfs_vn_lookup: simplify a bit Date: Sun, 13 May 2018 22:30:16 +0100 Message-Id: <20180513213017.31269-14-viro@ZenIV.linux.org.uk> In-Reply-To: <20180513213017.31269-1-viro@ZenIV.linux.org.uk> References: <20180513212612.GV30522@ZenIV.linux.org.uk> <20180513213017.31269-1-viro@ZenIV.linux.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: Al Viro have all post-xfs_lookup() branches converge on d_splice_alias() Cc: Darrick J. Wong Signed-off-by: Al Viro --- fs/xfs/xfs_iops.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index a3ed3c811dfa..df42e4cb4dc4 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -260,6 +260,7 @@ xfs_vn_lookup( struct dentry *dentry, unsigned int flags) { + struct inode *inode; struct xfs_inode *cip; struct xfs_name name; int error; @@ -269,14 +270,13 @@ xfs_vn_lookup( xfs_dentry_to_name(&name, dentry); error = xfs_lookup(XFS_I(dir), &name, &cip, NULL); - if (unlikely(error)) { - if (unlikely(error != -ENOENT)) - return ERR_PTR(error); - d_add(dentry, NULL); - return NULL; - } - - return d_splice_alias(VFS_I(cip), dentry); + if (likely(!error)) + inode = VFS_I(cip); + else if (likely(error == -ENOENT)) + inode = NULL; + else + inode = ERR_PTR(error); + return d_splice_alias(inode, dentry); } STATIC struct dentry * -- 2.11.0