Hi jaegeuk,chao:

    How about this version ?


On 2021/7/2 11:11, Fengnan Chang wrote:
We should allow write compress released file after truncate to zero.

Signed-off-by: Fengnan Chang <[email protected]>
---
  fs/f2fs/file.c | 7 +++++++
  1 file changed, 7 insertions(+)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 6afd4562335f..684fc2e8d8a4 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -740,6 +740,13 @@ int f2fs_truncate_blocks(struct inode *inode, u64 from, 
bool lock)
                return err;
#ifdef CONFIG_F2FS_FS_COMPRESSION
+       /*
+        * We should allow write compress released file
+        * after truncate to zero.
+        */
+       if (f2fs_compressed_file(inode) && !free_from)
+               clear_inode_flag(inode, FI_COMPRESS_RELEASED);
+
        if (from != free_from) {
                err = f2fs_truncate_partial_cluster(inode, from, lock);
                if (err)



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to