linux-f2fs-devel.lists.sourceforge.net archive mirror
 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

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 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).