From patchwork Tue May 29 14:46:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 10435809 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 71E8D602BF for ; Tue, 29 May 2018 14:53:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 633A72267B for ; Tue, 29 May 2018 14:53:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 580B42865F; Tue, 29 May 2018 14:53:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 195A22267B for ; Tue, 29 May 2018 14:53:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936629AbeE2Ovi (ORCPT ); Tue, 29 May 2018 10:51:38 -0400 Received: from mail-wr0-f169.google.com ([209.85.128.169]:36010 "EHLO mail-wr0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936622AbeE2Oqh (ORCPT ); Tue, 29 May 2018 10:46:37 -0400 Received: by mail-wr0-f169.google.com with SMTP id f16-v6so10662384wrm.3 for ; Tue, 29 May 2018 07:46:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hnq0F15Lz57rVF7uFKIpAcM34mStSrP7PakBXY0oP3U=; b=AtmsuHLkxpUr3NcVUZFTCpV5BmWjfCiMgDF/WSn64lgwGPG6tSFhsgLJDt5cjRut5T tfADoLAbMk6/LbzcMifjlWN11EbWh/Y8ng9Iu2KOnU6JTeV0cuYYQ54Awb4OvLhVkIE6 vMJeE156Sc0SH6M/jgIS9io+rlOwCoTCa/lCIQ1Ebvrh/mKCKDx0vR7xjTGQ/Yxbh34T /lQlYjirmANy9wVrzfs5XYYK2t31y3/GnXo9gj07t4/Qm589Qcjp9HG0Kqdi3hX68/kr dGqQEWymjbMyZwB/Myl90CPxfsoJt24odi7jsM+Y2PJnxp39dlcchHifSJjKX4MdDtQ/ cv1g== X-Gm-Message-State: ALKqPweEHUUHPFCdAYqvSWiNm9SbfnZZIxd0mknK5muWnWGHdOFTsNen e5Tk+n44MR3e0hbBw3QTmbsd5g== X-Google-Smtp-Source: AB8JxZrhGG506eGhlN1JHtA2X/hyhEaNTolMYuMD73eXw0zuClR1wlLTRKFl+o4dKksh2N5+qOGzNg== X-Received: by 2002:adf:c709:: with SMTP id k9-v6mr15006760wrg.65.1527605195897; Tue, 29 May 2018 07:46:35 -0700 (PDT) Received: from veci.piliscsaba.redhat.com (catv-176-63-54-97.catv.broadband.hu. [176.63.54.97]) by smtp.gmail.com with ESMTPSA id n71-v6sm20942227wmi.14.2018.05.29.07.46.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 May 2018 07:46:35 -0700 (PDT) From: Miklos Szeredi To: linux-unionfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 17/28] ovl: Move some dir related ovl_lookup_single() code in else block Date: Tue, 29 May 2018 16:46:01 +0200 Message-Id: <20180529144612.16675-18-mszeredi@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180529144612.16675-1-mszeredi@redhat.com> References: <20180529144612.16675-1-mszeredi@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Vivek Goyal Move some directory related code in else block. This is pure code reorganization and no functionality change. Next patch enables redirect processing on metacopy files and needs this change. By keeping non-functional changes in a separate patch, next patch looks much smaller and cleaner. Signed-off-by: Vivek Goyal Reviewed-by: Amir Goldstein Signed-off-by: Miklos Szeredi --- fs/overlayfs/namei.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c index b28b255ea8e2..451cd6effcf6 100644 --- a/fs/overlayfs/namei.c +++ b/fs/overlayfs/namei.c @@ -273,17 +273,18 @@ static int ovl_lookup_single(struct dentry *base, struct ovl_lookup_data *d, d->metacopy = err; d->stop = !d->metacopy; goto out; - } - if (last_element) - d->is_dir = true; - if (d->last) - goto out; - - if (ovl_is_opaquedir(this)) { - d->stop = true; + } else { if (last_element) - d->opaque = true; - goto out; + d->is_dir = true; + if (d->last) + goto out; + + if (ovl_is_opaquedir(this)) { + d->stop = true; + if (last_element) + d->opaque = true; + goto out; + } } err = ovl_check_redirect(this, d, prelen, post); if (err)