Skip to content

Commit 02d58cd

Browse files
Hyeong-Jun KimJaegeuk Kim
authored andcommitted
f2fs: compress: disallow disabling compress on non-empty compressed file
Compresse file and normal file has differ in i_addr addressing, specifically addrs per inode/block. So, we will face data loss, if we disable the compression flag on non-empty files. Therefore we should disallow not only enabling but disabling the compression flag on non-empty files. Fixes: 4c8ff70 ("f2fs: support data compression") Signed-off-by: Sungjong Seo <sj1557.seo@samsung.com> Signed-off-by: Hyeong-Jun Kim <hj514.kim@samsung.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent b368cc5 commit 02d58cd

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

fs/f2fs/f2fs.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4179,8 +4179,7 @@ static inline bool f2fs_disable_compressed_file(struct inode *inode)
41794179

41804180
if (!f2fs_compressed_file(inode))
41814181
return true;
4182-
if (S_ISREG(inode->i_mode) &&
4183-
(get_dirty_pages(inode) || atomic_read(&fi->i_compr_blocks)))
4182+
if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode))
41844183
return false;
41854184

41864185
fi->i_flags &= ~F2FS_COMPR_FL;

0 commit comments

Comments
 (0)