All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shijie Luo <luoshijie1@huawei.com>
To: Jan Kara <jack@suse.cz>
Cc: <linux-ext4@vger.kernel.org>, <tytso@mit.edu>, <linfeilong@huawei.com>
Subject: Re: [PATCH] jbd2: remove useless variable chksum_seen in do_one_pass
Date: Tue, 18 Aug 2020 19:33:31 +0800	[thread overview]
Message-ID: <ac6a4fd9-f2af-bad5-ce5d-ea728e9b64b2@huawei.com> (raw)
In-Reply-To: <20200818104826.GA1902@quack2.suse.cz>


On 2020/8/18 18:48, Jan Kara wrote:
> 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 <luoshijie1@huawei.com>
> 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

Thanks for your review,it 's definitely true to use these code as a 
substitute, but I think these are

a little bit hard to read.  By the way, I found a indentation error on 
"chksum_err = 1".

Do you think which one is better? I will take your opinion into account 
and send a v2 patch.



  reply	other threads:[~2020-08-18 11:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-11  2:21 [PATCH] jbd2: remove useless variable chksum_seen in do_one_pass Shijie Luo
2020-08-18 10:48 ` Jan Kara
2020-08-18 11:33   ` Shijie Luo [this message]
2020-08-18 19:14   ` Theodore Y. Ts'o
2020-08-19  2:02     ` Shijie Luo
2020-08-19  8:48     ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ac6a4fd9-f2af-bad5-ce5d-ea728e9b64b2@huawei.com \
    --to=luoshijie1@huawei.com \
    --cc=jack@suse.cz \
    --cc=linfeilong@huawei.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.