Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1590821 > unrolled thread

[PATCH] f2fs: correct cp_ver for compatibility to old image

Started byChao Yu <yuchao0@huawei.com>
First post2017-03-02 04:30 +0100
Last post2017-03-06 11:30 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] f2fs: correct cp_ver for compatibility to old image Chao Yu <yuchao0@huawei.com> - 2017-03-02 04:30 +0100
    Re: [PATCH] f2fs: correct cp_ver for compatibility to old image Jaegeuk Kim <jaegeuk@kernel.org> - 2017-03-02 22:00 +0100
      Re: [PATCH] f2fs: correct cp_ver for compatibility to old image Chao Yu <yuchao0@huawei.com> - 2017-03-06 11:30 +0100

#1590821 — [PATCH] f2fs: correct cp_ver for compatibility to old image

FromChao Yu <yuchao0@huawei.com>
Date2017-03-02 04:30 +0100
Subject[PATCH] f2fs: correct cp_ver for compatibility to old image
Message-ID<tgpBg-4Ck-11@gated-at.bofh.it>
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);
+
 	if (cpu_to_le64(cp_ver) != *(__le64 *)nm_i->nat_bits) {
 		disable_nat_bits(sbi, true);
 		return 0;
-- 
2.8.2.295.g3f1c1d0

[toc] | [next] | [standalone]


#1591458

FromJaegeuk Kim <jaegeuk@kernel.org>
Date2017-03-02 22:00 +0100
Message-ID<tgFZo-7Em-9@gated-at.bofh.it>
In reply to#1590821
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. 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

[toc] | [prev] | [next] | [standalone]


#1593156

FromChao Yu <yuchao0@huawei.com>
Date2017-03-06 11:30 +0100
Message-ID<thY3U-6MU-5@gated-at.bofh.it>
In reply to#1591458
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
> 
> .
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web