Commit 025b3602 authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim
Browse files

f2fs: compress: don't {,de}compress non-full cluster



f2fs won't compress non-full cluster in tail of file, let's skip
dirtying and rewrite such cluster during f2fs_ioc_{,de}compress_file.

Signed-off-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 3a2c0e55
Loading
Loading
Loading
Loading
+8 −12
Original line number Diff line number Diff line
@@ -4092,10 +4092,8 @@ static int f2fs_ioc_decompress_file(struct file *filp)
	last_idx = DIV_ROUND_UP(i_size_read(inode), PAGE_SIZE);

	count = last_idx - page_idx;
	while (count) {
		int len = min(cluster_size, count);

		ret = redirty_blocks(inode, page_idx, len);
	while (count && count >= cluster_size) {
		ret = redirty_blocks(inode, page_idx, cluster_size);
		if (ret < 0)
			break;

@@ -4105,8 +4103,8 @@ static int f2fs_ioc_decompress_file(struct file *filp)
				break;
		}

		count -= len;
		page_idx += len;
		count -= cluster_size;
		page_idx += cluster_size;

		cond_resched();
		if (fatal_signal_pending(current)) {
@@ -4172,10 +4170,8 @@ static int f2fs_ioc_compress_file(struct file *filp)
	last_idx = DIV_ROUND_UP(i_size_read(inode), PAGE_SIZE);

	count = last_idx - page_idx;
	while (count) {
		int len = min(cluster_size, count);

		ret = redirty_blocks(inode, page_idx, len);
	while (count && count >= cluster_size) {
		ret = redirty_blocks(inode, page_idx, cluster_size);
		if (ret < 0)
			break;

@@ -4185,8 +4181,8 @@ static int f2fs_ioc_compress_file(struct file *filp)
				break;
		}

		count -= len;
		page_idx += len;
		count -= cluster_size;
		page_idx += cluster_size;

		cond_resched();
		if (fatal_signal_pending(current)) {