summaryrefslogtreecommitdiff
path: root/fs/f2fs/file.c
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2020-03-10 20:50:09 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2020-03-11 08:25:38 -0700
commit2536ac6872e5265b4d9d263122cee02e3d5cae1d (patch)
tree872b42add5d2d5489a02d3162083f6ea82420bf9 /fs/f2fs/file.c
parent6cfdf15fdbff85acbaa92920bee88f37ca0404ba (diff)
f2fs: allow to clear F2FS_COMPR_FL flag
If regular inode has no compressed cluster, allow using 'chattr -c' to remove its compress flag, recovering it to a non-compressed file. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r--fs/f2fs/file.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 07f636732199..afc9a1a5a884 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1817,10 +1817,10 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask)
}
if ((iflags ^ masked_flags) & F2FS_COMPR_FL) {
- if (S_ISREG(inode->i_mode) &&
- (masked_flags & F2FS_COMPR_FL || i_size_read(inode) ||
- F2FS_HAS_BLOCKS(inode)))
- return -EINVAL;
+ if (S_ISREG(inode->i_mode) && (masked_flags & F2FS_COMPR_FL)) {
+ if (f2fs_disable_compressed_file(inode))
+ return -EINVAL;
+ }
if (iflags & F2FS_NOCOMP_FL)
return -EINVAL;
if (iflags & F2FS_COMPR_FL) {