]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
f2fs: do checkpoint when umount flag is not set
authorJaegeuk Kim <jaegeuk@kernel.org>
Thu, 15 Jan 2015 01:41:41 +0000 (17:41 -0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 12 Feb 2015 01:04:33 +0000 (17:04 -0800)
If the previous checkpoint was done without CP_UMOUNT flag, it needs to do
checkpoint with CP_UMOUNT for the next fast boot.

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

index 9f5317c9ad7292f238246f076bce11adada814ab..231d8c9fea0aa135bad92478d68d8a2e32b4cbf5 100644 (file)
@@ -1043,7 +1043,8 @@ void write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 
        mutex_lock(&sbi->cp_mutex);
 
-       if (!sbi->s_dirty && cpc->reason != CP_DISCARD)
+       if (!sbi->s_dirty &&
+                       cpc->reason != CP_DISCARD && cpc->reason != CP_UMOUNT)
                goto out;
        if (unlikely(f2fs_cp_error(sbi)))
                goto out;
index 84f95cd4076a8742a47f53644263f93df7833ccd..0d627f2d18289e4869a5795cdb48943a56fff811 100644 (file)
@@ -447,8 +447,13 @@ static void f2fs_put_super(struct super_block *sb)
        f2fs_destroy_stats(sbi);
        stop_gc_thread(sbi);
 
-       /* We don't need to do checkpoint when it's clean */
-       if (sbi->s_dirty) {
+       /*
+        * We don't need to do checkpoint when superblock is clean.
+        * But, the previous checkpoint was not done by umount, it needs to do
+        * clean checkpoint again.
+        */
+       if (sbi->s_dirty ||
+                       !is_set_ckpt_flags(F2FS_CKPT(sbi), CP_UMOUNT_FLAG)) {
                struct cp_control cpc = {
                        .reason = CP_UMOUNT,
                };