f2fs: compress: don't compress any datas after cp stop
authorChao Yu <yuchao0@huawei.com>
Tue, 26 May 2020 01:55:02 +0000 (09:55 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 28 May 2020 19:00:43 +0000 (12:00 -0700)
While compressed data writeback, we need to drop dirty pages like we did
for non-compressed pages if cp stops, however it's not needed to compress
any data in such case, so let's detect cp stop condition in
cluster_may_compress() to avoid redundant compressing and let following
f2fs_write_raw_pages() drops dirty pages correctly.

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

index bf152c0..a53578a 100644 (file)
@@ -849,6 +849,8 @@ static bool cluster_may_compress(struct compress_ctx *cc)
                return false;
        if (!f2fs_cluster_is_full(cc))
                return false;
+       if (unlikely(f2fs_cp_error(F2FS_I_SB(cc->inode))))
+               return false;
        return __cluster_may_compress(cc);
 }