From: Konstantin Tokarev <annulen@yandex.ru>
To: Yann Collet <yann.collet.73@gmail.com>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
Brent Taylor <motobud@gmail.com>,
Artem Bityutskiy <dedekind1@gmail.com>,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: lz4hc compression in UBIFS?
Date: Thu, 24 Oct 2013 19:15:23 +0400 [thread overview]
Message-ID: <106621382627723@web13g.yandex.ru> (raw)
In-Reply-To: <237221382623942@web21m.yandex.ru>
[-- Attachment #1: Type: text/plain, Size: 1440 bytes --]
24.10.2013, 18:20, "Konstantin Tokarev" <annulen@yandex.ru>:
> 23.10.2013, 22:26, "Yann Collet" <yann.collet.73@gmail.com>:
>
>> UBIFS error (pid 4288): ubifs_decompress: cannot decompress 12 bytes,
>> (...)
>> data size 12
>> data:
>> 00000000: 1f 00 01 00 ff e8 50 00 00 00 00 00
>>
>> The compressed format is correct.
>> It describes a flow of 00, of size ~500.
>>
>> So the problem seems more likely on the decompression side.
>>
>> Are you sure you are providing "12" as the "input size" parameter ? and that
>> the "maximum output size" parameter is correctly provided ? (i.e. >= to
>> original data size)
>
> Decompression code in kernel[1] is heavily modified. In particular, lz4_uncompress
> function (used in this case) does not have input size parameter at all,
> while it's present in lz4_uncompress_unknownoutputsize.
>
> [1] lib/lz4/lz4_decompress.c
Attached patch to crypto API wrapper for lz4hc seems to fix the issue. I can save
and read files on LZ4HC-compressed volume, and I'm running on LZ4HC-compressed rootfs,
flashed from mkfs.ubifs generated image (patch by Elie De Brauwer). My software
works correctly.
Unfortunately, on my board LZ4HC-compressed UBIFS volume performs noticeable worse
than LZO, while still faster than zlib. I guess the reason is that CPU is no longer a
bottleneck for my system, but NAND speed.
Thank you all for your help!
--
Regards,
Konstantin
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: crypto_lz4.patch --]
[-- Type: text/x-diff; name="crypto_lz4.patch", Size: 852 bytes --]
diff --git a/crypto/lz4.c b/crypto/lz4.c
index 4586dd1..91a0613 100644
--- a/crypto/lz4.c
+++ b/crypto/lz4.c
@@ -66,9 +66,8 @@ static int lz4_decompress_crypto(struct crypto_tfm *tfm, const u8 *src,
{
int err;
size_t tmp_len = *dlen;
- size_t __slen = slen;
- err = lz4_decompress(src, &__slen, dst, tmp_len);
+ err = lz4_decompress_unknownoutputsize(src, slen, dst, &tmp_len);
if (err < 0)
return -EINVAL;
diff --git a/crypto/lz4hc.c b/crypto/lz4hc.c
index 151ba31..9987741 100644
--- a/crypto/lz4hc.c
+++ b/crypto/lz4hc.c
@@ -66,9 +66,8 @@ static int lz4hc_decompress_crypto(struct crypto_tfm *tfm, const u8 *src,
{
int err;
size_t tmp_len = *dlen;
- size_t __slen = slen;
- err = lz4_decompress(src, &__slen, dst, tmp_len);
+ err = lz4_decompress_unknownoutputsize(src, slen, dst, &tmp_len);
if (err < 0)
return -EINVAL;
next prev parent reply other threads:[~2013-10-24 15:15 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-20 12:16 lz4hc compression in UBIFS? Konstantin Tokarev
2013-10-04 3:09 ` Brent Taylor
2013-10-04 7:44 ` Artem Bityutskiy
2013-10-04 8:06 ` Konstantin Tokarev
2013-10-21 15:59 ` Konstantin Tokarev
2013-10-22 3:43 ` Brent Taylor
2013-10-22 10:10 ` Konstantin Tokarev
2013-10-23 5:26 ` Brent Taylor
2013-10-23 7:40 ` Konstantin Tokarev
2013-10-23 12:49 ` Brent Taylor
2013-10-23 13:39 ` Konstantin Tokarev
2013-10-23 18:19 ` Yann Collet
2013-10-24 14:12 ` Konstantin Tokarev
2013-10-24 15:15 ` Konstantin Tokarev [this message]
2013-10-28 16:22 ` Konstantin Tokarev
2013-10-28 16:45 ` Florian Fainelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=106621382627723@web13g.yandex.ru \
--to=annulen@yandex.ru \
--cc=akpm@linux-foundation.org \
--cc=dedekind1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=motobud@gmail.com \
--cc=yann.collet.73@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox