Skip to content

Commit 87a91a1

Browse files
Sheng YongJaegeuk Kim
authored andcommitted
f2fs: only set release for file that has compressed data
If a file is not comprssed yet or does not have compressed data, for example, its data has a very low compression ratio, do not set FI_COMPRESS_RELEASED flag. Signed-off-by: Sheng Yong <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent c31e496 commit 87a91a1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

fs/f2fs/file.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3510,13 +3510,15 @@ static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg)
35103510
if (ret)
35113511
goto out;
35123512

3513+
if (!atomic_read(&F2FS_I(inode)->i_compr_blocks)) {
3514+
ret = -EPERM;
3515+
goto out;
3516+
}
3517+
35133518
set_inode_flag(inode, FI_COMPRESS_RELEASED);
35143519
inode->i_ctime = current_time(inode);
35153520
f2fs_mark_inode_dirty_sync(inode, true);
35163521

3517-
if (!atomic_read(&F2FS_I(inode)->i_compr_blocks))
3518-
goto out;
3519-
35203522
f2fs_down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
35213523
filemap_invalidate_lock(inode->i_mapping);
35223524

0 commit comments

Comments
 (0)