|
@@ -270,7 +270,7 @@ static int get_victim_by_default(struct f2fs_sb_info *sbi,
|
|
{
|
|
{
|
|
struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
|
|
struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
|
|
struct victim_sel_policy p;
|
|
struct victim_sel_policy p;
|
|
- unsigned int secno, max_cost;
|
|
|
|
|
|
+ unsigned int secno, max_cost, last_victim;
|
|
unsigned int last_segment = MAIN_SEGS(sbi);
|
|
unsigned int last_segment = MAIN_SEGS(sbi);
|
|
unsigned int nsearched = 0;
|
|
unsigned int nsearched = 0;
|
|
|
|
|
|
@@ -285,6 +285,7 @@ static int get_victim_by_default(struct f2fs_sb_info *sbi,
|
|
if (p.max_search == 0)
|
|
if (p.max_search == 0)
|
|
goto out;
|
|
goto out;
|
|
|
|
|
|
|
|
+ last_victim = sbi->last_victim[p.gc_mode];
|
|
if (p.alloc_mode == LFS && gc_type == FG_GC) {
|
|
if (p.alloc_mode == LFS && gc_type == FG_GC) {
|
|
p.min_segno = check_bg_victims(sbi);
|
|
p.min_segno = check_bg_victims(sbi);
|
|
if (p.min_segno != NULL_SEGNO)
|
|
if (p.min_segno != NULL_SEGNO)
|
|
@@ -332,7 +333,10 @@ static int get_victim_by_default(struct f2fs_sb_info *sbi,
|
|
}
|
|
}
|
|
next:
|
|
next:
|
|
if (nsearched >= p.max_search) {
|
|
if (nsearched >= p.max_search) {
|
|
- sbi->last_victim[p.gc_mode] = segno;
|
|
|
|
|
|
+ if (!sbi->last_victim[p.gc_mode] && segno <= last_victim)
|
|
|
|
+ sbi->last_victim[p.gc_mode] = last_victim + 1;
|
|
|
|
+ else
|
|
|
|
+ sbi->last_victim[p.gc_mode] = segno + 1;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|