From: Yangtao Li Date: Mon, 23 Jan 2023 09:46:01 +0000 (+0800) Subject: f2fs: allow set compression option of files without blocks X-Git-Tag: v6.2.5~190 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7158fb10182e9cb21d64c11923caa901f50c8afb;p=thirdparty%2Fkernel%2Fstable.git f2fs: allow set compression option of files without blocks [ Upstream commit e6261beb0c629403dc58997294dd521bd23664af ] 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 Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 2498e5c70fd83..78e6015ce3a6f 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -3945,7 +3945,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; }