On 2016/9/22 18:55, Chao Yu wrote:
> On 2016/9/22 11:48, Yunlei He wrote:
>> For forground gc, if can't find a victim in one max_victim_search,
>> try it again.
>>
>> Signed-off-by: Yunlei He <heyun...@huawei.com>
>> ---
>>  fs/f2fs/gc.c | 23 ++++++++++++-----------
>>  1 file changed, 12 insertions(+), 11 deletions(-)
>>
>> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
>> index 24acbbb..19e51a5 100644
>> --- a/fs/f2fs/gc.c
>> +++ b/fs/f2fs/gc.c
>> @@ -916,24 +916,25 @@ gc_more:
>>              goto stop;
>>      }
>>
>> -    if (gc_type == BG_GC && has_not_enough_free_secs(sbi, sec_freed, 0)) {
>> -            gc_type = FG_GC;
>> +    if (gc_type == BG_GC && has_not_enough_free_secs(sbi, 0, 0)) {
>>              /*
>>               * If there is no victim and no prefree segment but still not
>>               * enough free sections, we should flush dent/node blocks and do
>>               * garbage collections.
>>               */
>> -            if (__get_victim(sbi, &segno, gc_type) ||
>> -                                            prefree_segments(sbi)) {
>> -                    write_checkpoint(sbi, &cpc);
>> -                    segno = NULL_SEGNO;
>> -            } else if (has_not_enough_free_secs(sbi, 0, 0)) {
>> -                    write_checkpoint(sbi, &cpc);
>> -            }
>> +            gc_type = FG_GC;
>> +            write_checkpoint(sbi, &cpc);
>>      }
>>
>> -    if (segno == NULL_SEGNO && !__get_victim(sbi, &segno, gc_type))
>> -            goto stop;
>> +    if (!__get_victim(sbi, &segno, gc_type)) {
>> +            if (sync)
>> +                    goto stop;
>> +            else if (gc_type == FG_GC
>> +                            && has_not_enough_free_secs(sbi, sec_freed, 0))
>> +                    goto gc_more;
>
> Will we deadloop here?
>
Does no victim(whole partition) and has_not_enough_free_secs both satisfied at 
the same time?

If stop FG_GC here, it will come again soon, besides, sec_freed will not change 
to free segments,

for no checkpoint update.

Thanks,

> Thanks,
>
>> +            else
>> +                    goto stop;
>> +    }
>>      ret = 0;
>>
>>      if (do_garbage_collect(sbi, segno, &gc_list, gc_type) &&
>>
>
>
> .
>


------------------------------------------------------------------------------
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to