summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/checkpoint.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2014-08-11 18:37:46 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2014-08-21 09:21:02 -0700
commit8501017e50fb7586ba522a2913ce664d6c2024f6 (patch)
treebfb14ec6356d4d760553e235644be9f146462eff /fs/f2fs/checkpoint.c
parent5274651927a76c947469a589e3d2a9adbd075da6 (diff)
downloadop-kernel-dev-8501017e50fb7586ba522a2913ce664d6c2024f6.zip
op-kernel-dev-8501017e50fb7586ba522a2913ce664d6c2024f6.tar.gz
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>
Diffstat (limited to 'fs/f2fs/checkpoint.c')
-rw-r--r--fs/f2fs/checkpoint.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 6f38aad..dc29b78 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)
trace_f2fs_write_checkpoint(sbi->sb, is_umount, "start block_ops");
mutex_lock(&sbi->cp_mutex);
+
+ if (!sbi->s_dirty)
+ goto out;
+
block_operations(sbi);
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)
do_checkpoint(sbi, is_umount);
unblock_operations(sbi);
- mutex_unlock(&sbi->cp_mutex);
-
stat_inc_cp_count(sbi->stat_info);
+out:
+ mutex_unlock(&sbi->cp_mutex);
trace_f2fs_write_checkpoint(sbi->sb, is_umount, "finish checkpoint");
}
OpenPOWER on IntegriCloud