lkml.org 
[lkml]   [2021]   [Oct]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] f2fs: compress: disallow disabling compress on non-empty compressed file
From
On 2021/10/25 22:05, Hyeong-Jun Kim wrote:
> Compresse file and normal file has differ in i_addr addressing,
> specifically addrs per inode/block. So, we will face data loss, if we
> disable the compression flag on non-empty files. Therefore we should
> disallow not only enabling but disabling the compression flag on
> non-empty files. >

Hi Hyeong-Jun,

I think this makes sense.

But one more case may bypass below condition, could you please take a look
at this case:

touch file
chattr +c file
f2fs_io pinfile set file
fallocate file -o 0 -l 16384 -n
chattr -c file

So it's better to check F2FS_HAS_BLOCKS() as well in the condition?

Fixes: 4c8ff7095bef ("f2fs: support data compression")

Thanks,

> Signed-off-by: Sungjong Seo <sj1557.seo@samsung.com>
> Signed-off-by: Hyeong-Jun Kim <hj514.kim@samsung.com>
> ---
> fs/f2fs/f2fs.h | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index b8e8f8c716b0..19146c834abd 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -4177,8 +4177,7 @@ static inline bool f2fs_disable_compressed_file(struct inode *inode)
>
> if (!f2fs_compressed_file(inode))
> return true;
> - if (S_ISREG(inode->i_mode) &&
> - (get_dirty_pages(inode) || atomic_read(&fi->i_compr_blocks)))
> + if (S_ISREG(inode->i_mode) && inode->i_size)
> return false;
>
> fi->i_flags &= ~F2FS_COMPR_FL;
>

\
 
 \ /
  Last update: 2021-10-27 04:31    [W:0.029 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site