f2fs: allow set compression option of files without blocks
authorYangtao Li <frank.li@vivo.com>
Mon, 23 Jan 2023 09:46:01 +0000 (17:46 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 31 Jan 2023 18:47:46 +0000 (10:47 -0800)
Files created by truncate have a size but no blocks, so
they can be allowed to set compression option.

Fixes: e1e8debec656 ("f2fs: add F2FS_IOC_SET_COMPRESS_OPTION ioctl")
Signed-off-by: Yangtao Li <frank.li@vivo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/file.c

index f5c1b78..391da47 100644 (file)
@@ -3941,7 +3941,7 @@ static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg)
                goto out;
        }
 
-       if (inode->i_size != 0) {
+       if (F2FS_HAS_BLOCKS(inode)) {
                ret = -EFBIG;
                goto out;
        }