All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Jaegeuk Kim <jaegeuk@kernel.org>, 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: Fri, 2 Jul 2021 06:52:00 +0800	[thread overview]
Message-ID: <47b9737f-b0e0-8483-773e-646a8cf3e2ec@kernel.org> (raw)
In-Reply-To: <YN31AyWCu4QhSCaa@google.com>

On 2021/7/2 1:01, Jaegeuk Kim wrote:
> 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?

Agreed, but please document this behavior as well.

Thanks,

> 
>> +	}
>> +
>>   #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 22:52 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
2021-07-01 22:52   ` 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=47b9737f-b0e0-8483-773e-646a8cf3e2ec@kernel.org \
    --to=chao@kernel.org \
    --cc=changfengnan@vivo.com \
    --cc=jaegeuk@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.