f2fs: avoid race for summary information

In order to do GC more reliably, I'd like to lock the vicitm summary page
until its GC is completed, and also prevent any checkpoint process.

Reviewed-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
This commit is contained in:
Jaegeuk Kim
2013-04-01 08:32:21 +09:00
父節點 60374688a1
當前提交 b74737541c
共有 3 個文件被更改,包括 7 次插入10 次删除

查看文件

@@ -137,10 +137,13 @@ int f2fs_sync_fs(struct super_block *sb, int sync)
if (!sbi->s_dirty && !get_pages(sbi, F2FS_DIRTY_NODES))
return 0;
if (sync)
if (sync) {
mutex_lock(&sbi->gc_mutex);
write_checkpoint(sbi, false);
else
mutex_unlock(&sbi->gc_mutex);
} else {
f2fs_balance_fs(sbi);
}
return 0;
}