f2fs: allow set compression option of files without blocks

Message ID 20230123094601.32940-1-frank.li@vivo.com
State New
Headers
Series f2fs: allow set compression option of files without blocks |

Commit Message

李扬韬 Jan. 23, 2023, 9:46 a.m. UTC
  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>
---
 fs/f2fs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Chao Yu Jan. 29, 2023, 10:02 a.m. UTC | #1
On 2023/1/23 17:46, Yangtao Li wrote:
> 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>

Thanks,
  
patchwork-bot+f2fs@kernel.org Jan. 30, 2023, 11 p.m. UTC | #2
Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:

On Mon, 23 Jan 2023 17:46:01 +0800 you wrote:
> 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>
> ---
>  fs/f2fs/file.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
  - [f2fs-dev] f2fs: allow set compression option of files without blocks
    https://git.kernel.org/jaegeuk/f2fs/c/0f837b84b2af

You are awesome, thank you!
  

Patch

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index b3bcb50490bd..fda04c37b48c 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -3990,7 +3990,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;
 	}