On 2018/2/5 15:42, Chao Yu wrote:
> On 2018/2/5 22:30, Weichao Guo wrote:
>> NAT bits are saved at spare space in CP pack. Flushed NAT bits
>> may be overwritten by the CP pack if there is no enough space
>> for NAT bits. And NAT bits will be obsolesced at next mount time
>> if crc|cp_ver not matched. So just skip to flush NAT bits in such
>> needless cases.
>>
>> Signed-off-by: Weichao Guo <guoweic...@huawei.com>
>> ---
>>  fs/f2fs/checkpoint.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
>> index 0eaafb8..bdc03c9 100644
>> --- a/fs/f2fs/checkpoint.c
>> +++ b/fs/f2fs/checkpoint.c
>> @@ -1248,7 +1248,9 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, 
>> struct cp_control *cpc)
>>      start_blk = __start_cp_next_addr(sbi);
>>  
>>      /* write nat bits */
>> -    if (enabled_nat_bits(sbi, cpc)) {
>> +    if (enabled_nat_bits(sbi, cpc) &&
>> +                    le32_to_cpu(ckpt->cp_pack_total_block_count) <=
>> +                    sbi->blocks_per_seg - NM_I(sbi)->nat_bits_blocks) {
> 
> Have checked this condition in update_ckpt_flags, right?
Oh,yes. It's my mistake.

Thanks,
> 
> thanks,
> 
>>              __u64 cp_ver = cur_cp_version(ckpt);
>>              block_t blk;
>>  
>>
> 
> 
> .
> 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to