summaryrefslogtreecommitdiff
path: root/fs/f2fs/file.c
diff options
context:
space:
mode:
authorChao Liu <liuchao@coolpad.com>2022-07-07 12:09:24 +0300
committerJaegeuk Kim <jaegeuk@kernel.org>2022-07-31 06:17:06 +0300
commita8634ccf5d626506100bb753327e36e6c6b3df70 (patch)
treeca80f42843f5d4fa25c48d1b05c8808b982efefd /fs/f2fs/file.c
parent7165841d578e0592848e09dc9d131aa30be44e1b (diff)
downloadlinux-a8634ccf5d626506100bb753327e36e6c6b3df70.tar.xz
f2fs: allow compression of files without blocks
Files created by truncate(1) have a size but no blocks, so they can be allowed to enable compression. Signed-off-by: Chao Liu <liuchao@coolpad.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r--fs/f2fs/file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index eb43852752a6..6b1b030830ca 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1879,7 +1879,7 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask)
if (iflags & F2FS_COMPR_FL) {
if (!f2fs_may_compress(inode))
return -EINVAL;
- if (S_ISREG(inode->i_mode) && inode->i_size)
+ if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode))
return -EINVAL;
set_compress_context(inode);