Commit 2536ac68 authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim
Browse files

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: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 6cfdf15f
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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)))
		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) {