Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp27704452rwd; Tue, 4 Jul 2023 06:47:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlEFVSi2GWrN/4i3v5wx6Gq9Sw7rlODa62PUrckRCnOCoyKHTix/VrA+p6AIHS+X/vNjdaPE X-Received: by 2002:a05:6a00:1415:b0:664:aff0:240 with SMTP id l21-20020a056a00141500b00664aff00240mr11505708pfu.33.1688478461990; Tue, 04 Jul 2023 06:47:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688478461; cv=none; d=google.com; s=arc-20160816; b=Wos5VPlnU+pWlsdKDHl/xvRq6wSrtLiodQKeRIeKWYYyE5ICMht/girI7ctpt8segV q6zeuqPgu1LvdoKf/Sn9ItlrBvgloP6H1PoHyz8ZpQ5fr7XdeK+hpQK4lKkw5eJZEHdR 8/FCc+dzBwbwLcHZ3typdFf9zLb8s8ewn4w2GmO1u/5pd8c864MAqIQdymZMLQWR8fPQ eEvP9IP8msr/8DhiSLrdSDKhplSvWLKdizjgW11UF3PTe6HIecQi/ccmRMXgAcvSf7R9 uIOl4fcgRCD9TIBcWGul8RVPaz0XiDSbattULrFrrSxPJRdLJhwpLPDFiNGlYk0Y30/s dDXw== 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=oS7Vxm0DAmNNgMMIUjtMD1WG5PuUkGz9+7MDzwUnu9w=; fh=Uq/HK0tePPZ4uFSrjmAoQ+8fm8HBRKIYZPcFTEYnhm4=; b=y5/IvaY/OTGMc7/sVsyIvvu5hCHB4QdTXapSwyhOQYZIFHsT0agUhilFzbS++Rcok0 2xW4yB+kfuhDD0gXtvQfLJjSos5uLD1ssGonlTbo6cbPF8g/6Gwt6rjJVzclGLQDumZj 3E13HDzCbgHQ3QQB53xd1UcK5IexWuUNC2tXkZg84bOkRDev8pkJ2NjsMVQKssYpaQeE euHAkeI0Zqjo9zF9ncUdko56r/kh6BdaPoslEwJHq82NN4IleXMzM5Juck535Zs7GW6J FORY3vhB8rhC4CKbmg0pucK5F9jwB82ibcUThZDSeenRhZ8shmxMJKxJvn5ZGCQaI3eX AUxA== 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 ck9-20020a056a00328900b0066e4ceca38fsi19530437pfb.283.2023.07.04.06.47.29; Tue, 04 Jul 2023 06:47:41 -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 S231608AbjGDNoS (ORCPT + 99 others); Tue, 4 Jul 2023 09:44:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231626AbjGDNoI (ORCPT ); Tue, 4 Jul 2023 09:44:08 -0400 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29AD7EE for ; Tue, 4 Jul 2023 06:44:08 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4QwPCP1vwLz4f3n6q for ; Tue, 4 Jul 2023 21:44:01 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgD3rLASIqRk9WjENA--.31120S9; Tue, 04 Jul 2023 21:44:01 +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, chengzhihao1@huawei.com, yukuai3@huawei.com Subject: [PATCH 05/12] jbd2: open code jbd2_verify_csum_type() helper Date: Tue, 4 Jul 2023 21:42:26 +0800 Message-Id: <20230704134233.110812-6-yi.zhang@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230704134233.110812-1-yi.zhang@huaweicloud.com> References: <20230704134233.110812-1-yi.zhang@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgD3rLASIqRk9WjENA--.31120S9 X-Coremail-Antispam: 1UD129KBjvJXoW7trW7Ww1xZw47WFWDKFy8Krg_yoW8Wryfpr W3GFy8urWv9ry7A3W0yF4kAFWrZw4YkFWUWFsrC3Z2vay7ZwnrJ345tr1rXa4FyFy8C3y0 qF1rKws2k3Wjv3JanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9C14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F 4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq 3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7 IYx2IY67AKxVWUXVWUAwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4U M4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCF04k20xvY0x0EwIxGrw CFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE 14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2 IY67AKxVWUCVW8JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxK x2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI 0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUl2NtUUUUU= X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 --- 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.39.2