linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: compress: fix to avoid fragment w/ OPU during f2fs_ioc_compress_file()
@ 2023-09-04 15:12 Chao Yu
  2023-09-20 15:50 ` patchwork-bot+f2fs
  0 siblings, 1 reply; 2+ messages in thread
From: Chao Yu @ 2023-09-04 15:12 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-kernel, linux-f2fs-devel

If file has both cold and compress flag, during f2fs_ioc_compress_file(),
f2fs will trigger IPU for non-compress cluster and OPU for compress
cluster, so that, data of the file may be fragmented.

Fix it by always triggering OPU for IOs from user mode compression.

Signed-off-by: Chao Yu <chao@kernel.org>
---
 fs/f2fs/data.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 2a38d2cc2140..d4b59c57d827 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2665,6 +2665,11 @@ bool f2fs_should_update_outplace(struct inode *inode, struct f2fs_io_info *fio)
 		return true;
 	if (f2fs_is_atomic_file(inode))
 		return true;
+	/* rewrite low ratio compress data w/ OPU mode to avoid fragmentation */
+	if (f2fs_compressed_file(inode) &&
+		F2FS_OPTION(sbi).compress_mode == COMPR_MODE_USER &&
+		is_inode_flag_set(inode, FI_ENABLE_COMPRESS))
+		return true;
 
 	/* swap file is migrating in aligned write mode */
 	if (is_inode_flag_set(inode, FI_ALIGNED_WRITE))
-- 
2.40.1



_______________________________________________
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] 2+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: compress: fix to avoid fragment w/ OPU during f2fs_ioc_compress_file()
  2023-09-04 15:12 [f2fs-dev] [PATCH] f2fs: compress: fix to avoid fragment w/ OPU during f2fs_ioc_compress_file() Chao Yu
@ 2023-09-20 15:50 ` patchwork-bot+f2fs
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+f2fs @ 2023-09-20 15:50 UTC (permalink / raw)
  To: Chao Yu; +Cc: jaegeuk, linux-kernel, linux-f2fs-devel

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:

On Mon,  4 Sep 2023 23:12:42 +0800 you wrote:
> If file has both cold and compress flag, during f2fs_ioc_compress_file(),
> f2fs will trigger IPU for non-compress cluster and OPU for compress
> cluster, so that, data of the file may be fragmented.
> 
> Fix it by always triggering OPU for IOs from user mode compression.
> 
> Signed-off-by: Chao Yu <chao@kernel.org>
> 
> [...]

Here is the summary with links:
  - [f2fs-dev] f2fs: compress: fix to avoid fragment w/ OPU during f2fs_ioc_compress_file()
    https://git.kernel.org/jaegeuk/f2fs/c/943f7c6f987f

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




_______________________________________________
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] 2+ messages in thread

end of thread, other threads:[~2023-09-20 15:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-04 15:12 [f2fs-dev] [PATCH] f2fs: compress: fix to avoid fragment w/ OPU during f2fs_ioc_compress_file() Chao Yu
2023-09-20 15:50 ` patchwork-bot+f2fs

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