Skip to content

Commit 943f7c6

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: compress: fix to avoid fragment w/ OPU during f2fs_ioc_compress_file()
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 <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent a463938 commit 943f7c6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/f2fs/data.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2665,6 +2665,11 @@ bool f2fs_should_update_outplace(struct inode *inode, struct f2fs_io_info *fio)
26652665
return true;
26662666
if (f2fs_is_atomic_file(inode))
26672667
return true;
2668+
/* rewrite low ratio compress data w/ OPU mode to avoid fragmentation */
2669+
if (f2fs_compressed_file(inode) &&
2670+
F2FS_OPTION(sbi).compress_mode == COMPR_MODE_USER &&
2671+
is_inode_flag_set(inode, FI_ENABLE_COMPRESS))
2672+
return true;
26682673

26692674
/* swap file is migrating in aligned write mode */
26702675
if (is_inode_flag_set(inode, FI_ALIGNED_WRITE))

0 commit comments

Comments
 (0)