linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Fengnan Chang <changfengnan@vivo.com>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: compress: allow write compress released file after truncate to zero
Date: Thu, 1 Jul 2021 10:01:55 -0700	[thread overview]
Message-ID: <YN31AyWCu4QhSCaa@google.com> (raw)
In-Reply-To: <20210628130550.39696-1-changfengnan@vivo.com>

On 06/28, Fengnan Chang wrote:
> We should allow write compress released file after truncate to zero.
> 
> Signed-off-by: Fengnan Chang <changfengnan@vivo.com>
> ---
>  fs/f2fs/file.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 6afd4562335f..b91ae8f751c5 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -730,9 +730,13 @@ int f2fs_truncate_blocks(struct inode *inode, u64 from, bool lock)
>  	 * for compressed file, only support cluster size
>  	 * aligned truncation.
>  	 */
> -	if (f2fs_compressed_file(inode))
> +	if (f2fs_compressed_file(inode)) {
>  		free_from = round_up(from,
>  				F2FS_I(inode)->i_cluster_size << PAGE_SHIFT);
> +		if (!free_from)
> +			clear_inode_flag(inode, FI_COMPRESS_RELEASED);

We can do after truncating all the blocks successfully?

> +	}
> +
>  #endif
>  
>  	err = f2fs_do_truncate_blocks(inode, free_from, lock);
> -- 
> 2.29.0


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  reply	other threads:[~2021-07-01 17:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-28 13:05 [f2fs-dev] [PATCH] f2fs: compress: allow write compress released file after truncate to zero Fengnan Chang
2021-07-01 17:01 ` Jaegeuk Kim [this message]
2021-07-01 22:52   ` Chao Yu

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=YN31AyWCu4QhSCaa@google.com \
    --to=jaegeuk@kernel.org \
    --cc=changfengnan@vivo.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /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;
as well as URLs for NNTP newsgroup(s).