From: Chao Yu <chao@kernel.org>
To: Hyeong-Jun Kim <hj514.kim@samsung.com>, Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Sungjong Seo <sj1557.seo@samsung.com>,
linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] f2fs: compress: disallow disabling compress on non-empty compressed file
Date: Wed, 27 Oct 2021 10:30:24 +0800 [thread overview]
Message-ID: <d5ac2754-85a3-8935-d1f8-829539664ca0@kernel.org> (raw)
In-Reply-To: <20211025140517.14741-1-hj514.kim@samsung.com>
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;
>
prev parent reply other threads:[~2021-10-27 2:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20211025140526epcas1p3b4a59df0935297572c6417c841a4c514@epcas1p3.samsung.com>
2021-10-25 14:05 ` Hyeong-Jun Kim
2021-10-27 2:30 ` Chao Yu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d5ac2754-85a3-8935-d1f8-829539664ca0@kernel.org \
--to=chao@kernel.org \
--cc=hj514.kim@samsung.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=sj1557.seo@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®