Signed-off-by: Hou Pengyang <[email protected]>
---
fs/f2fs/gc.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 6c996e3..eaf9e68 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -293,13 +293,22 @@ static int get_victim_by_default(struct f2fs_sb_info *sbi,
unsigned int secno, last_victim;
unsigned int last_segment = MAIN_SEGS(sbi);
unsigned int nsearched = 0;
+ int nr_dirty;
mutex_lock(&dirty_i->seglist_lock);
p.alloc_mode = alloc_mode;
- select_policy(sbi, gc_type, type, &p);
-
p.min_segno = NULL_SEGNO;
+
+ if (alloc_mode == SSR)
+ nr_dirty = dirty_i->nr_dirty[type];
+ else
+ nr_dirty = dirty_i->nr_dirty[DIRTY];
+
+ if (!nr_dirty)
+ goto out;
+
+ select_policy(sbi, gc_type, type, &p);
p.min_cost = get_max_cost(sbi, &p);
if (p.max_search == 0)
--
2.10.1
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel