Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2439818pxp; Mon, 21 Mar 2022 20:31:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztH4NthcsUvJvtSfRSu5CjYPkJEodJjFaqC4o5785KiUs/feCevOsHmmzFNu8qC/UCAeEs X-Received: by 2002:a17:90b:1bc8:b0:1c7:443:3ffb with SMTP id oa8-20020a17090b1bc800b001c704433ffbmr2571885pjb.84.1647919877615; Mon, 21 Mar 2022 20:31:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647919877; cv=none; d=google.com; s=arc-20160816; b=hukgwetuJeyRkaSl1iYnS5ppWDn4AUM2Jp4MlN8nfDGZyYCM+QmKaSe71dVKi9GOTM XG/gP6xTYWolBdB10EosRm59yf7UsAdMxdPIjP+OCXy0TxScMbDxgQoY5v1HYq7iRGhQ u9PbOSLbK2gLB1FXrZCLO0zWm1mtIhOVRFNmG0Vigit54obuoxc+D6xSEm0/QoccpO0V WYCahDQIhWPp7EcOFOTRsLPDNK0z5NMjYw74LEMEjg9stm9ldhoMwesgh5K10hynJdxV QshryqAkc9cC6QTAqoQ0aBchHxEtIlg3dLOSLBuScpEQ6kgou8TP/oNphTIVxIoTj5K8 A4HA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fBT7erZTt1m18lb5R6igGQweADLkZ3FPVET5hQ9jvB0=; b=tShtKbFsIyD70ORjYRmwJkLeI4Au5fViI5qUn9wGHCn14fTQcXusypRZgi/gGSppIY WjwFt2INp6YJ8ku8AEeiwKIhzaPyDB2GzgXJsAfEj4vJS0A8ZV6PvuUuBiTxaVKTaE1C IwDHMx8dDfs67K9W24fSAfuf/SV5wkPR4OTUy0u5i5KhUNFOfe7VDXREiEI5U+jDPFu4 est9oFXYsB+U/Gk6MlTCTvkuhCz3ilBrtwappGnYQQZB1qJB15+jP5idVmc1QqfpNvE2 bURvCmisGPNfpwknMf+O/lP5xb+VVwokIQfghvyc5wtubNMNl0Oo4ZRvu1j0yfX49XXT 5EWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=WbonEwN4; spf=softfail (google.com: domain of transitioning linux-ext4-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s190-20020a632cc7000000b003816043efd9si13718070pgs.462.2022.03.21.20.31.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 20:31:17 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-ext4-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=WbonEwN4; spf=softfail (google.com: domain of transitioning linux-ext4-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9A08D3B2A12; Mon, 21 Mar 2022 20:00:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235756AbiCVDCC (ORCPT + 99 others); Mon, 21 Mar 2022 23:02:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235759AbiCVDB4 (ORCPT ); Mon, 21 Mar 2022 23:01:56 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B97363CCCC3 for ; Mon, 21 Mar 2022 20:00:29 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id 4FE281F413D3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1647918028; bh=kqkciCrqxPaGMYalJ3yGrHWLeiWSTcQ+ToF7JIySmPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WbonEwN4BS3rmF3IbyukzEHZv97o/vcmyOCI9J1lOz9QzDLuF67Rw44UzhTBoytFN xpdEIwoZy9qe+Nd1AsjdwNv3YemErR5E1Z98rp2Z5OPdjohMw4sMapG7wWcU1PP7aS AxwELfHdpCX3KSKTho6xTlY0CNkMIXoxsd9GDK+FSOWeG1bkaSNCwYYqGrPrgtnMiN 375/wwPZo5XaBEr9wgns2pui15yMWg2q+VBZNd6+blmfT+w/0T1XbmbGlhH9MbBW1I 5eFUJiyfaw9F6yve3ycFpsKbP6f9QERxnCWt/TfQcFmAFRDY7RaQEoCDYLJauCit8E oGnQXGUPaEUqg== From: Gabriel Krisman Bertazi To: tytso@mit.edu Cc: ebiggers@kernel.org, jaegeuk@kernel.org, linux-ext4@vger.kernel.org, Gabriel Krisman Bertazi , kernel@collabora.com Subject: [PATCH 4/5] ext4: Simplify hash check on ext4_match Date: Mon, 21 Mar 2022 23:00:03 -0400 Message-Id: <20220322030004.148560-5-krisman@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220322030004.148560-1-krisman@collabora.com> References: <20220322030004.148560-1-krisman@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org The existence of fname->cf_name.name requires s_encoding & IS_CASEFOLDED, therefore this can be simplified. Signed-off-by: Gabriel Krisman Bertazi --- fs/ext4/namei.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 71b4b05fae89..8520115cd5c2 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -1442,19 +1442,13 @@ static bool ext4_match(struct inode *parent, #if IS_ENABLED(CONFIG_UNICODE) f.cf_name = fname->cf_name; - if (parent->i_sb->s_encoding && IS_CASEFOLDED(parent) && - (!IS_ENCRYPTED(parent) || fscrypt_has_encryption_key(parent))) { - if (fname->cf_name.name) { - if (IS_ENCRYPTED(parent)) { - if (fname->hinfo.hash != EXT4_DIRENT_HASH(de) || - fname->hinfo.minor_hash != - EXT4_DIRENT_MINOR_HASH(de)) { - - return false; - } - } - } + if (IS_ENCRYPTED(parent) && fname->cf_name.name) { + if (fname->hinfo.hash != EXT4_DIRENT_HASH(de) || + fname->hinfo.minor_hash != EXT4_DIRENT_MINOR_HASH(de)) + return false; + } + if (parent->i_sb->s_encoding && IS_CASEFOLDED(parent)) { ret = ext4_ci_compare(parent, &f, de->name, de->name_len); if (ret < 0) { /* -- 2.35.1