Skip to contentSkip to conversation

f2fs: compress: don't compress any datas after cp stop

PATCH In review Chao Yu 1 participant 2 messages May 26, 2020 – May 28, 2020 F2FS file system

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 1/1 f2fs: compress: don't compress any datas after cp stop

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.

---
 fs/f2fs/compress.c | 2 ++
 1 file changed, 2 insertions(+)
fs/f2fs/compress.c +2 -0
index bf152c0d79fe..a53578a89211 100644
@@ -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);
 }
 
Signature · 1 line
2.18.0.rc1
author
#1 lore raw

Jaegeuk, could you please review this patch?

Quoted 25 lines · Chao Yu

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.

---
 fs/f2fs/compress.c | 2 ++
 1 file changed, 2 insertions(+)
fs/f2fs/compress.c +2 -0
index bf152c0d79fe..a53578a89211 100644
@@ -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);
 }