All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chao Yu <yuchao0@huawei.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: chao@kernel.org, linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] f2fs: correct cp_ver for compatibility to old image
Date: Mon, 6 Mar 2017 18:23:03 +0800	[thread overview]
Message-ID: <2b7a24e8-9c85-9646-059b-153a4f796bef@huawei.com> (raw)
In-Reply-To: <20170302185518.GA1030@jaegeuk.local>

On 2017/3/3 2:55, Jaegeuk Kim wrote:
> On 03/02, Chao Yu wrote:
>> There is no CP_CRC_RECOVERY_FLAG tagged in checkpoint pack, calculate
>> cp_version as old format.
>>
>> Signed-off-by: Chao Yu <yuchao0@huawei.com>
>> ---
>>  fs/f2fs/node.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
>> index 6c027b6833f4..0d46404ca769 100644
>> --- a/fs/f2fs/node.c
>> +++ b/fs/f2fs/node.c
>> @@ -2507,7 +2507,9 @@ static int __get_nat_bitmaps(struct f2fs_sb_info *sbi)
>>  		f2fs_put_page(page, 1);
>>  	}
>>  
>> -	cp_ver |= (cur_cp_crc(ckpt) << 32);
>> +	if (__is_set_ckpt_flags(ckpt, CP_CRC_RECOVERY_FLAG))
>> +		cp_ver |= (cur_cp_crc(ckpt) << 32);
> 
> Well, we always write nat_bits with crc. So if it's different, something is
> wrong and we need to drop it.

Got it. :)

Thanks,

> CP-CRC_RECOVERY_FLAG is used for roll-forward recovery, which is a different context.
> 
>> +
>>  	if (cpu_to_le64(cp_ver) != *(__le64 *)nm_i->nat_bits) {
>>  		disable_nat_bits(sbi, true);
>>  		return 0;
>> -- 
>> 2.8.2.295.g3f1c1d0
> 
> .
> 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot

WARNING: multiple messages have this Message-ID (diff)
From: Chao Yu <yuchao0@huawei.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: <linux-f2fs-devel@lists.sourceforge.net>,
	<linux-kernel@vger.kernel.org>, <chao@kernel.org>
Subject: Re: [PATCH] f2fs: correct cp_ver for compatibility to old image
Date: Mon, 6 Mar 2017 18:23:03 +0800	[thread overview]
Message-ID: <2b7a24e8-9c85-9646-059b-153a4f796bef@huawei.com> (raw)
In-Reply-To: <20170302185518.GA1030@jaegeuk.local>

On 2017/3/3 2:55, Jaegeuk Kim wrote:
> On 03/02, Chao Yu wrote:
>> There is no CP_CRC_RECOVERY_FLAG tagged in checkpoint pack, calculate
>> cp_version as old format.
>>
>> Signed-off-by: Chao Yu <yuchao0@huawei.com>
>> ---
>>  fs/f2fs/node.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
>> index 6c027b6833f4..0d46404ca769 100644
>> --- a/fs/f2fs/node.c
>> +++ b/fs/f2fs/node.c
>> @@ -2507,7 +2507,9 @@ static int __get_nat_bitmaps(struct f2fs_sb_info *sbi)
>>  		f2fs_put_page(page, 1);
>>  	}
>>  
>> -	cp_ver |= (cur_cp_crc(ckpt) << 32);
>> +	if (__is_set_ckpt_flags(ckpt, CP_CRC_RECOVERY_FLAG))
>> +		cp_ver |= (cur_cp_crc(ckpt) << 32);
> 
> Well, we always write nat_bits with crc. So if it's different, something is
> wrong and we need to drop it.

Got it. :)

Thanks,

> CP-CRC_RECOVERY_FLAG is used for roll-forward recovery, which is a different context.
> 
>> +
>>  	if (cpu_to_le64(cp_ver) != *(__le64 *)nm_i->nat_bits) {
>>  		disable_nat_bits(sbi, true);
>>  		return 0;
>> -- 
>> 2.8.2.295.g3f1c1d0
> 
> .
> 

  reply	other threads:[~2017-03-06 10:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-02  3:22 [PATCH] f2fs: correct cp_ver for compatibility to old image Chao Yu
2017-03-02  3:22 ` Chao Yu
2017-03-02 18:55 ` Jaegeuk Kim
2017-03-02 18:55   ` Jaegeuk Kim
2017-03-06 10:23   ` Chao Yu [this message]
2017-03-06 10:23     ` Chao Yu

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=2b7a24e8-9c85-9646-059b-153a4f796bef@huawei.com \
    --to=yuchao0@huawei.com \
    --cc=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /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.