]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
f2fs: skip searching dirty map if dirty segment is not exist
authorChao Yu <chao2.yu@samsung.com>
Mon, 5 Oct 2015 14:20:40 +0000 (22:20 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 9 Oct 2015 23:20:56 +0000 (16:20 -0700)
When searching victim during gc, if there are no dirty segments in
filesystem, we will still take the time to search the whole dirty segment
map, it's not needed, it's better to skip in this condition.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/gc.c

index e5c255ba227bb86f3c3ab3c94d79a18ac84ecd51..d844a80285279d501211b2c64b5d8a3158c265c7 100644 (file)
@@ -268,6 +268,9 @@ static int get_victim_by_default(struct f2fs_sb_info *sbi,
        p.min_segno = NULL_SEGNO;
        p.min_cost = max_cost = get_max_cost(sbi, &p);
 
+       if (p.max_search == 0)
+               goto out;
+
        if (p.alloc_mode == LFS && gc_type == FG_GC) {
                p.min_segno = check_bg_victims(sbi);
                if (p.min_segno != NULL_SEGNO)
@@ -329,6 +332,7 @@ got_it:
                                sbi->cur_victim_sec,
                                prefree_segments(sbi), free_segments(sbi));
        }
+out:
        mutex_unlock(&dirty_i->seglist_lock);
 
        return (p.min_segno == NULL_SEGNO) ? 0 : 1;