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 <[email protected]>
---
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel