f2fs: set CP_TRIMMED_FLAG correctly
authorChao Yu <yuchao0@huawei.com>
Wed, 14 Jun 2017 15:00:55 +0000 (23:00 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 4 Jul 2017 09:11:47 +0000 (02:11 -0700)
Don't set CP_TRIMMED_FLAG for non-zoned block device or discard
unsupported device, it can avoid to trigger unneeded checkpoint for
that kind of device.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/super.c

index 9081570..8e39b85 100644 (file)
@@ -587,7 +587,7 @@ static void f2fs_put_super(struct super_block *sb)
        /* be sure to wait for any on-going discard commands */
        f2fs_wait_discard_bios(sbi);
 
-       if (!sbi->discard_blks) {
+       if (f2fs_discard_en(sbi) && !sbi->discard_blks) {
                struct cp_control cpc = {
                        .reason = CP_UMOUNT | CP_TRIMMED,
                };