Commit 78134d03 authored by Daeho Jeong's avatar Daeho Jeong Committed by Jaegeuk Kim

f2fs: change return value of f2fs_disable_compressed_file to bool

The returned integer is not required anywhere. So we need to change
the return value to bool type.
Signed-off-by: default avatarDaeho Jeong <daehojeong@google.com>
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent c2759eba
...@@ -3996,7 +3996,7 @@ static int f2fs_swap_activate(struct swap_info_struct *sis, struct file *file, ...@@ -3996,7 +3996,7 @@ static int f2fs_swap_activate(struct swap_info_struct *sis, struct file *file,
if (ret) if (ret)
return ret; return ret;
if (f2fs_disable_compressed_file(inode)) if (!f2fs_disable_compressed_file(inode))
return -EINVAL; return -EINVAL;
ret = check_swap_activate(sis, file, span); ret = check_swap_activate(sis, file, span);
......
...@@ -3963,26 +3963,21 @@ static inline void set_compress_context(struct inode *inode) ...@@ -3963,26 +3963,21 @@ static inline void set_compress_context(struct inode *inode)
f2fs_mark_inode_dirty_sync(inode, true); f2fs_mark_inode_dirty_sync(inode, true);
} }
static inline u32 f2fs_disable_compressed_file(struct inode *inode) static inline bool f2fs_disable_compressed_file(struct inode *inode)
{ {
struct f2fs_inode_info *fi = F2FS_I(inode); struct f2fs_inode_info *fi = F2FS_I(inode);
u32 i_compr_blocks;
if (!f2fs_compressed_file(inode)) if (!f2fs_compressed_file(inode))
return 0; return true;
if (S_ISREG(inode->i_mode)) { if (S_ISREG(inode->i_mode) &&
if (get_dirty_pages(inode)) (get_dirty_pages(inode) || atomic_read(&fi->i_compr_blocks)))
return 1; return false;
i_compr_blocks = atomic_read(&fi->i_compr_blocks);
if (i_compr_blocks)
return i_compr_blocks;
}
fi->i_flags &= ~F2FS_COMPR_FL; fi->i_flags &= ~F2FS_COMPR_FL;
stat_dec_compr_inode(inode); stat_dec_compr_inode(inode);
clear_inode_flag(inode, FI_COMPRESSED_FILE); clear_inode_flag(inode, FI_COMPRESSED_FILE);
f2fs_mark_inode_dirty_sync(inode, true); f2fs_mark_inode_dirty_sync(inode, true);
return 0; return true;
} }
#define F2FS_FEATURE_FUNCS(name, flagname) \ #define F2FS_FEATURE_FUNCS(name, flagname) \
......
...@@ -1813,7 +1813,7 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask) ...@@ -1813,7 +1813,7 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask)
if ((iflags ^ masked_flags) & F2FS_COMPR_FL) { if ((iflags ^ masked_flags) & F2FS_COMPR_FL) {
if (masked_flags & F2FS_COMPR_FL) { if (masked_flags & F2FS_COMPR_FL) {
if (f2fs_disable_compressed_file(inode)) if (!f2fs_disable_compressed_file(inode))
return -EINVAL; return -EINVAL;
} }
if (iflags & F2FS_NOCOMP_FL) if (iflags & F2FS_NOCOMP_FL)
...@@ -3246,7 +3246,7 @@ static int f2fs_ioc_set_pin_file(struct file *filp, unsigned long arg) ...@@ -3246,7 +3246,7 @@ static int f2fs_ioc_set_pin_file(struct file *filp, unsigned long arg)
if (ret) if (ret)
goto out; goto out;
if (f2fs_disable_compressed_file(inode)) { if (!f2fs_disable_compressed_file(inode)) {
ret = -EOPNOTSUPP; ret = -EOPNOTSUPP;
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment