Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2992653pxa; Tue, 18 Aug 2020 03:49:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVUXpbQv77XRRbpGrlXibgxvWZeTxFUJyxLluF6qK9uUBO+Yc/haR4Smgam0F/3iIyX31N X-Received: by 2002:a17:906:f1da:: with SMTP id gx26mr19787832ejb.129.1597747744100; Tue, 18 Aug 2020 03:49:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597747744; cv=none; d=google.com; s=arc-20160816; b=AkPoRJpx4TU1Gl+Cspn1gt24jZko0CHCsZlGKuyn+rKIrBsbJdUdnO6G8LYFobLK30 9IlOYIB1sddFIX+9nqWrJA8I1Pln8fMwkB+IOxxokfQdvwun6spwR4RgZZzHnpU3YSUv CMssfXRFT/4YxLjmYxvh59/i9eIqeSiT1VNnrga6lKctXuNgM/CIfOaMD0ErZMv/x1Au 1aoQs3K2rzcShGMRqJB9ybYRDVknXfT/dw2Y52/EsPzxSVXmJDODdzWCy8WmMirkpLKd 4Ld2d02UnjuyXvS7+kLN6HUs0aQFu51a3ADtwpIsE7OpSW7/1s/On62zHxkegw6pKg2G K/Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=lBJfIARdSHGFPyFOgVKBgGXu+Szp8sKwqoJlJoO3zkM=; b=J1yDkIXTqP8cbv+lOiiqlZR6SWs6jMiHHn8IGsNwArMqMzWqV+EO2vX9aKX/Sgz6HO smc+c+neLC1ASNlnuPyP6PRC9fen71XLrhiSfoeSrkwbVLMbCSpP05BXihbbgf8mVKUo yryB1BoUm6By+9jRWR0DCJoH/OKTm6+Bl8fNXEjpeQmSWcs1rVnAyN6sbIM3BM+TfrPK H/AvYzR9t++Xgxut2SB3ORJ4kFLQ1SkrPwFAhVZ3YS4wa8MAtIkG5vDmoxNdGPm32S2L fw6tIL7/UfcWHSB6FYyE/+k7vHF67VbrD1j2+8wUXN9ozBGMRW3xaRxeogRCjrrQAYtK 2abQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l15si12947131edr.130.2020.08.18.03.48.32; Tue, 18 Aug 2020 03:49:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726763AbgHRKs1 (ORCPT + 99 others); Tue, 18 Aug 2020 06:48:27 -0400 Received: from mx2.suse.de ([195.135.220.15]:37090 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726203AbgHRKs1 (ORCPT ); Tue, 18 Aug 2020 06:48:27 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2BF6BB6AB; Tue, 18 Aug 2020 10:48:52 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 0C7861E12CB; Tue, 18 Aug 2020 12:48:26 +0200 (CEST) Date: Tue, 18 Aug 2020 12:48:26 +0200 From: Jan Kara To: Shijie Luo Cc: linux-ext4@vger.kernel.org, tytso@mit.edu, jack@suse.cz, linfeilong@huawei.com Subject: Re: [PATCH] jbd2: remove useless variable chksum_seen in do_one_pass Message-ID: <20200818104826.GA1902@quack2.suse.cz> References: <20200811022128.32690-1-luoshijie1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200811022128.32690-1-luoshijie1@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Mon 10-08-20 22:21:28, Shijie Luo wrote: > This variable only indicates that we do checksum success, while > chksum_err can also do. Moreover, condition "!chksum_seen" in else > if bracket is pointless. > > Signed-off-by: Shijie Luo Thanks for the patch! Some comments below. > @@ -709,11 +707,10 @@ static int do_one_pass(journal_t *journal, > cbh->h_chksum_type == JBD2_CRC32_CHKSUM && > cbh->h_chksum_size == > JBD2_CRC32_CHKSUM_SIZE) > - chksum_seen = 1; > + chksum_err = 0; > else if (!(cbh->h_chksum_type == 0 && > cbh->h_chksum_size == 0 && > - found_chksum == 0 && > - !chksum_seen)) > + found_chksum == 0)) > /* > * If fs is mounted using an old kernel and then > * kernel with journal_chksum is used then we I agree the use of chksum_err & chksum_seen looks rather arbitrary. In fact the code seems to be equivalent to: /* Neither checksum match nor unused? */ if (!(crc32_sum == found_chksum && cbh->h_chksum_type == JBD2_CRC32_CHKSUM && cbh->h_chksum_size == JBD2_CRC32_CHKSUM_SIZE) && !(cbh->h_chksum_type == 0 && cbh->h_chksum_size == 0 && found_chksum == 0)) { info->end_transaction = next_commit_ID; if (jbd2_has_feature_async_commit(journal)) { ... } } crc32_sum = ~0; which would be even simpler... Honza -- Jan Kara SUSE Labs, CR