Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp831014rwl; Thu, 10 Aug 2023 02:11:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4Q0yWZ0rlp3JjMWp/EAVh4F2uIeWO04fV4/RhSESiBGKQlwB0dknG1qnCtzm14zyUs5ar X-Received: by 2002:a17:90a:448a:b0:268:dad:2fdc with SMTP id t10-20020a17090a448a00b002680dad2fdcmr1544698pjg.21.1691658718083; Thu, 10 Aug 2023 02:11:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691658718; cv=none; d=google.com; s=arc-20160816; b=MFRiX8RMif++QY0ee1Sgcmm2epO/jKZMhc3Qhf3NgsvljAiBqaCzow4m8XZyRDqqTx SiIIbZOJD+/PB1i6WxePLrtehF00YB0i6EsIrrpKmxYN0jS3zhqkUMUJNrTMImPUWOxw TYafmBapqwulLgEGL8IGfUgD/sr6ypMdkxfYR7N8N3e4VX1QW59oPoz4zEHFA/AbvoFg fcp1k5fPfAzYFtDFgP7NURJn1x2oEpupf4M0Ra8DuqrANqmNbDc4RtWAi7erULF+++dY GVTW46GZfeqpUJBiIjXH7mK3NUJ1jUGICl1fGEIJs2MRbqfQFN2/Z4FjAHcLpETl8q0T RPMw== 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; bh=2UcgUbTmIe448RbmpMvwacLTN+Y7NmvJWQHCid9mIT0=; fh=fTSaBofNXp03thGUSjn2fCTzw7oFshHI80Fe6i8kpiM=; b=f+LCOZjeVR/2o2NggJuPTBpq7vF7nLmNPgdZWB9cLUqgMH4NzUkLSRoqsvLM2PqoyA an44Un2EXcWuUY7hzO41GviRJ+dl55xepYACYUDOAqqWVSu15PBrH6dYu3BPphZ97kpF neE/e7Z1aVTiP6vhjdzzRbRMhUGOEUHeBkT/wkwBscFwxVavHVDkzVtkIoq0uAxwhdM6 LWJ9Cycf/SBwbLOPECCj3/5B0XR6furtO315oBO/qBu1O+tWR/jFmJX/2io2jN2y0/tq uxs5hY1BtNok/zqtZ0HCOyQ/i/0ZeYCMOlDRLiqdk5pxnKWdg5bDF4aIk3BiWjY9kjqq PT1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c5-20020a17090a8d0500b002630f1d7650si3326004pjo.46.2023.08.10.02.11.44; Thu, 10 Aug 2023 02:11:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229604AbjHJIyr (ORCPT + 99 others); Thu, 10 Aug 2023 04:54:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232324AbjHJIyg (ORCPT ); Thu, 10 Aug 2023 04:54:36 -0400 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A54D0213F for ; Thu, 10 Aug 2023 01:54:35 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4RM12G5vZSz4f41Gd for ; Thu, 10 Aug 2023 16:54:30 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.170]) by APP4 (Coremail) with SMTP id gCh0CgD3hqm6pdRkGjJ7AQ--.1500S9; Thu, 10 Aug 2023 16:54:31 +0800 (CST) From: Zhang Yi To: linux-ext4@vger.kernel.org Cc: tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, yi.zhang@huawei.com, yi.zhang@huaweicloud.com, yukuai3@huawei.com Subject: [PATCH v2 05/12] jbd2: open code jbd2_verify_csum_type() helper Date: Thu, 10 Aug 2023 16:54:10 +0800 Message-Id: <20230810085417.1501293-6-yi.zhang@huaweicloud.com> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20230810085417.1501293-1-yi.zhang@huaweicloud.com> References: <20230810085417.1501293-1-yi.zhang@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgD3hqm6pdRkGjJ7AQ--.1500S9 X-Coremail-Antispam: 1UD129KBjvJXoW7trWxXry3Cr4UZF4xuF43trb_yoW8WFyUpr W3Ga48uryv9ry7A3W0yF4kAFWrZa1YkFWUWFsF93Z2vay7ZwnrJ345tr1rXa4FyFy8C3y0 qF1rKws2k3Wjva7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9C14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F 4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq 3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7 IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4U M4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCF04k20xvY0x0EwIxGrw CFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE 14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2 IY67AKxVWUCVW8JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxK x2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI 0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUArcfUUUUU= X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 From: Zhang Yi jbd2_verify_csum_type() helper check checksum type in the superblock for v2 or v3 checksum feature, it always return true if these features are not enabled, and it has only one user, so open code it is more clear. Signed-off-by: Zhang Yi Reviewed-by: Jan Kara --- fs/jbd2/journal.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index d84f26b08315..46ab47b4439e 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -115,14 +115,6 @@ void __jbd2_debug(int level, const char *file, const char *func, #endif /* Checksumming functions */ -static int jbd2_verify_csum_type(journal_t *j, journal_superblock_t *sb) -{ - if (!jbd2_journal_has_csum_v2or3_feature(j)) - return 1; - - return sb->s_checksum_type == JBD2_CRC32C_CHKSUM; -} - static __be32 jbd2_superblock_csum(journal_t *j, journal_superblock_t *sb) { __u32 csum; @@ -1429,13 +1421,13 @@ static int journal_get_superblock(journal_t *journal) goto out; } - if (!jbd2_verify_csum_type(journal, sb)) { - printk(KERN_ERR "JBD2: Unknown checksum type\n"); - goto out; - } - /* Load the checksum driver */ if (jbd2_journal_has_csum_v2or3_feature(journal)) { + if (sb->s_checksum_type != JBD2_CRC32C_CHKSUM) { + printk(KERN_ERR "JBD2: Unknown checksum type\n"); + goto out; + } + journal->j_chksum_driver = crypto_alloc_shash("crc32c", 0, 0); if (IS_ERR(journal->j_chksum_driver)) { printk(KERN_ERR "JBD2: Cannot load crc32c driver.\n"); -- 2.34.3