On Thu, Aug 04, 2022 at 09:41:40PM +0800, Chao Yu wrote:
> From: Chao Yu <[email protected]>
> 
> This patch disallow to enable file compression in image which doesn't
> support compression feature.
> 
> Signed-off-by: Chao Yu <[email protected]>
> ---
>  fs/f2fs/file.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 24f5b02c78e7..4a3f4eaa3fc5 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -1872,6 +1872,8 @@ static int f2fs_setflags_common(struct inode *inode, 
> u32 iflags, u32 mask)
>                       if (!f2fs_disable_compressed_file(inode))
>                               return -EINVAL;
>               } else {
> +                     if (!f2fs_sb_has_compression(F2FS_I_SB(inode)))
> +                             return -EOPNOTSUPP;
>                       if (!f2fs_may_compress(inode))
>                               return -EINVAL;
>                       if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode))
> -- 

How is this different from the same check that occurs earlier in the function?

- Eric


_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to