mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
f2fs: Explicitly flush device upon foreground GC
GC itself will produce some dirty segments. This will allow more GCs to be made upon rapid GC or urgent GC. Change-Id: I47b7bc230e47976d1d25014a2c40adc84fe06833 Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com> Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
parent
03134c1347
commit
5f196d7d8b
14
fs/f2fs/gc.c
14
fs/f2fs/gc.c
@ -1773,9 +1773,10 @@ int f2fs_gc(struct f2fs_sb_info *sbi, struct f2fs_gc_control *gc_control)
|
||||
.ilist = LIST_HEAD_INIT(gc_list.ilist),
|
||||
.iroot = RADIX_TREE_INIT(gc_list.iroot, GFP_NOFS),
|
||||
};
|
||||
struct super_block *sb = sbi->sb;
|
||||
unsigned int skipped_round = 0, round = 0;
|
||||
|
||||
trace_f2fs_gc_begin(sbi->sb, gc_type, gc_control->no_bg_gc,
|
||||
trace_f2fs_gc_begin(sb, gc_type, gc_control->no_bg_gc,
|
||||
gc_control->nr_free_secs,
|
||||
get_pages(sbi, F2FS_DIRTY_NODES),
|
||||
get_pages(sbi, F2FS_DIRTY_DENTS),
|
||||
@ -1788,7 +1789,7 @@ int f2fs_gc(struct f2fs_sb_info *sbi, struct f2fs_gc_control *gc_control)
|
||||
cpc.reason = __get_cp_reason(sbi);
|
||||
sbi->skipped_gc_rwsem = 0;
|
||||
gc_more:
|
||||
if (unlikely(!(sbi->sb->s_flags & MS_ACTIVE))) {
|
||||
if (unlikely(!(sb->s_flags & MS_ACTIVE))) {
|
||||
ret = -EINVAL;
|
||||
goto stop;
|
||||
}
|
||||
@ -1877,7 +1878,7 @@ stop:
|
||||
if (gc_type == FG_GC)
|
||||
f2fs_unpin_all_sections(sbi, true);
|
||||
|
||||
trace_f2fs_gc_end(sbi->sb, ret, total_freed, sec_freed,
|
||||
trace_f2fs_gc_end(sb, ret, total_freed, sec_freed,
|
||||
get_pages(sbi, F2FS_DIRTY_NODES),
|
||||
get_pages(sbi, F2FS_DIRTY_DENTS),
|
||||
get_pages(sbi, F2FS_DIRTY_IMETA),
|
||||
@ -1892,6 +1893,13 @@ stop:
|
||||
|
||||
if (gc_control->err_gc_skipped && !ret)
|
||||
ret = sec_freed ? 0 : -EAGAIN;
|
||||
|
||||
if (gc_type == FG_GC && down_read_trylock(&sb->s_umount)) {
|
||||
writeback_inodes_sb(sb, WB_REASON_SYNC);
|
||||
sync_inodes_sb(sb);
|
||||
up_read(&sb->s_umount);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user