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 <shengyong@oppo.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
c31e496157
commit
87a91a1559
@ -3510,13 +3510,15 @@ static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg)
|
|||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
if (!atomic_read(&F2FS_I(inode)->i_compr_blocks)) {
|
||||||
|
ret = -EPERM;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
set_inode_flag(inode, FI_COMPRESS_RELEASED);
|
set_inode_flag(inode, FI_COMPRESS_RELEASED);
|
||||||
inode->i_ctime = current_time(inode);
|
inode->i_ctime = current_time(inode);
|
||||||
f2fs_mark_inode_dirty_sync(inode, true);
|
f2fs_mark_inode_dirty_sync(inode, true);
|
||||||
|
|
||||||
if (!atomic_read(&F2FS_I(inode)->i_compr_blocks))
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
f2fs_down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
|
f2fs_down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
|
||||||
filemap_invalidate_lock(inode->i_mapping);
|
filemap_invalidate_lock(inode->i_mapping);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user