All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: compress: allow write compress released file after truncate to zero
@ 2021-06-28 13:05 Fengnan Chang
  2021-07-01 17:01 ` Jaegeuk Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Fengnan Chang @ 2021-06-28 13:05 UTC (permalink / raw)
  To: jaegeuk, chao, linux-f2fs-devel; +Cc: Fengnan Chang

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);
+	}
+
 #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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: compress: allow write compress released file after truncate to zero
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Jaegeuk Kim @ 2021-07-01 17:01 UTC (permalink / raw)
  To: Fengnan Chang; +Cc: linux-f2fs-devel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: compress: allow write compress released file after truncate to zero
  2021-07-01 17:01 ` Jaegeuk Kim
@ 2021-07-01 22:52   ` Chao Yu
  0 siblings, 0 replies; 3+ messages in thread
From: Chao Yu @ 2021-07-01 22:52 UTC (permalink / raw)
  To: Jaegeuk Kim, Fengnan Chang; +Cc: linux-f2fs-devel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-01 22:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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.