Просмотр исходного кода

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>
Stefan Agner 12 лет назад
Родитель
Сommit
59516f6017
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      fs/btrfs/lzo.c

+ 3 - 1
fs/btrfs/lzo.c

@@ -207,8 +207,10 @@ static int lzo_compress_pages(struct list_head *ws,
 		}
 		}
 
 
 		/* we're making it bigger, give up */
 		/* 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;
 			goto out;
+		}
 
 
 		/* we're all done */
 		/* we're all done */
 		if (tot_in >= len)
 		if (tot_in >= len)