[PATCH v0] mkfs.ubifs: Add support for lz4hc compressor in mkfs.ubifs
Konstantin Tokarev
annulen at yandex.ru
Sat Oct 5 07:17:31 PDT 2013
05.10.2013, 17:52, "Konstantin Tokarev" <annulen at yandex.ru>:
> 05.10.2013, 17:25, "Konstantin Tokarev" <annulen at yandex.ru>:
>
>> 05.10.2013, 16:56, "Elie De Brauwer" <eliedebrauwer at gmail.com>:
>>> That's odd, yesterday I started by cloning mtd-utils.git and when I
>>> try to repeat my own steps and apply my patch it does seem to work.
>> I've figured it out: you've included patch into the mail instead of attaching
>> it as a file, so I copied it, and tab characters got lost. patch -p1 -l
>> works successfully.
>
> When trying to compress my rootfs, I got message "32866 compression errors occurred".
> Resulting image is much larger than LZO one (133M for lz4hc, 86M for lzo, 79M for zlib)
The next patch over your patch fixes the issue:
diff --git a/mkfs.ubifs/compr.c b/mkfs.ubifs/compr.c
index 2030042..65c7dbe 100644
--- a/mkfs.ubifs/compr.c
+++ b/mkfs.ubifs/compr.c
@@ -109,9 +109,10 @@ static int lz4hc_compress(void *in_buf, size_t in_len, void *out_buf,
size_t *out_len)
{
int ret;
- ret = LZ4_compressHC_limitedOutput(in_buf, out_buf, in_len, *out_len);
+ ret = LZ4_compressHC(in_buf, out_buf, in_len);
+ *out_len = ret;
- if (ret != 0) {
+ if (ret == 0) {
errcnt += 1;
return -1;
}
I've replaced LZ4_compressHC_limitedOutput with LZ4_compressHC to match lzo_compress logic which changes out_len instead of limiting it. No errors are reported now. However, result is still larger than LZO (93M).
--
Regards,
Konstantin
More information about the linux-mtd
mailing list