aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2014-08-11 21:37:46 -0400
committerJaegeuk Kim <jaegeuk@kernel.org>2014-08-21 12:21:02 -0400
commit8501017e50fb7586ba522a2913ce664d6c2024f6 (patch)
treebfb14ec6356d4d760553e235644be9f146462eff
parent5274651927a76c947469a589e3d2a9adbd075da6 (diff)
f2fs: check s_dirty under cp_mutex
It needs to check s_dirty under cp_mutex, since s_dirty is reset under that mutex. And previous condition was not correct, since we can omit doing checkpoint when checkpoint was done followed by all the node pages were written back. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fs/f2fs/checkpoint.c8
-rw-r--r--fs/f2fs/super.c3
2 files changed, 6 insertions, 5 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 6f38aad8e654..dc29b7837687 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -952,6 +952,10 @@ void write_checkpoint(struct f2fs_sb_info *sbi, bool is_umount)
952 trace_f2fs_write_checkpoint(sbi->sb, is_umount, "start block_ops"); 952 trace_f2fs_write_checkpoint(sbi->sb, is_umount, "start block_ops");
953 953
954 mutex_lock(&sbi->cp_mutex); 954 mutex_lock(&sbi->cp_mutex);
955
956 if (!sbi->s_dirty)
957 goto out;
958
955 block_operations(sbi); 959 block_operations(sbi);
956 960
957 trace_f2fs_write_checkpoint(sbi->sb, is_umount, "finish block_ops"); 961 trace_f2fs_write_checkpoint(sbi->sb, is_umount, "finish block_ops");
@@ -976,9 +980,9 @@ void write_checkpoint(struct f2fs_sb_info *sbi, bool is_umount)
976 do_checkpoint(sbi, is_umount); 980 do_checkpoint(sbi, is_umount);
977 981
978 unblock_operations(sbi); 982 unblock_operations(sbi);
979 mutex_unlock(&sbi->cp_mutex);
980
981 stat_inc_cp_count(sbi->stat_info); 983 stat_inc_cp_count(sbi->stat_info);
984out:
985 mutex_unlock(&sbi->cp_mutex);
982 trace_f2fs_write_checkpoint(sbi->sb, is_umount, "finish checkpoint"); 986 trace_f2fs_write_checkpoint(sbi->sb, is_umount, "finish checkpoint");
983} 987}
984 988
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 8aabe3ef42f6..e7a7b619ffd4 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -460,9 +460,6 @@ int f2fs_sync_fs(struct super_block *sb, int sync)
460 460
461 trace_f2fs_sync_fs(sb, sync); 461 trace_f2fs_sync_fs(sb, sync);
462 462
463 if (!sbi->s_dirty && !get_pages(sbi, F2FS_DIRTY_NODES))
464 return 0;
465
466 if (sync) { 463 if (sync) {
467 mutex_lock(&sbi->gc_mutex); 464 mutex_lock(&sbi->gc_mutex);
468 write_checkpoint(sbi, false); 465 write_checkpoint(sbi, false);