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 9081570bc616b0a6f0d30088845ad35f141b2883..8e39b850bfc0901bd672f3c4bedc7495d44276c1 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,
                };