summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/lzo.c
diff options
context:
space:
mode:
authorStefan Agner <stefan@agner.ch>2013-07-01 20:33:39 +0200
committerChris Mason <chris.mason@fusionio.com>2013-09-01 07:57:19 -0400
commit59516f6017c589e7316418fda6128ba8f829a77f (patch)
tree88140a72bddf7db4cd6a44bbf29a4dddbbba99b9 /fs/btrfs/lzo.c
parentc8cc6341653721b54760480b0d0d9b5f09b46741 (diff)
downloadop-kernel-dev-59516f6017c589e7316418fda6128ba8f829a77f.zip
op-kernel-dev-59516f6017c589e7316418fda6128ba8f829a77f.tar.gz
Btrfs: return -1 when lzo compression makes data bigger
With this fix the lzo code behaves like the zlib code by returning an error code when compression does not help reduce the size of the file. This is currently not a bug since the compressed size is checked again in the calling method compress_file_range. Signed-off-by: Stefan Agner <stefan@agner.ch> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/lzo.c')
-rw-r--r--fs/btrfs/lzo.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c
index f93151a..b6a6f07 100644
--- a/fs/btrfs/lzo.c
+++ b/fs/btrfs/lzo.c
@@ -207,8 +207,10 @@ static int lzo_compress_pages(struct list_head *ws,
}
/* we're making it bigger, give up */
- if (tot_in > 8192 && tot_in < tot_out)
+ if (tot_in > 8192 && tot_in < tot_out) {
+ ret = -1;
goto out;
+ }
/* we're all done */
if (tot_in >= len)
OpenPOWER on IntegriCloud