From: Konstantin Tokarev <annulen@yandex.ru>
To: Brent Taylor <motobud@gmail.com>
Cc: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
Artem Bityutskiy <dedekind1@gmail.com>
Subject: Re: lz4hc compression in UBIFS?
Date: Fri, 04 Oct 2013 12:06:02 +0400 [thread overview]
Message-ID: <409951380873962@web7m.yandex.ru> (raw)
In-Reply-To: <CAP+RiCAVuUEfyjg02+ZjeFXgUuaRW+fuMB490Ce2Hq_4qHBL=A@mail.gmail.com>
04.10.2013, 07:09, "Brent Taylor" <motobud@gmail.com>:
> Here is a patch based on linux-3.12-rc3. I haven't performed any
> performance testing UBIFS using lz4hc, but I can mount UBIFS volumes
> and haven't seen any problems yet.
Thank you!
Are you planning to implement a patch for mtd-utils (mkfs.ubifs) as well?
> The only think I know that isn't
> correct about the patch is the description for the Kconfig element for
> select lz4hc as a compression option. I only copied the description
> from the lzo description.
>
> diff -uN -uNr linux-3.12-rc3.orig/fs/ubifs/compress.c
> linux-3.12-rc3/fs/ubifs/compress.c
> --- linux-3.12-rc3.orig/fs/ubifs/compress.c 2013-09-29
> 17:02:38.000000000 -0500
> +++ linux-3.12-rc3/fs/ubifs/compress.c 2013-07-17 21:57:27.440653860 -0500
> @@ -53,6 +53,22 @@
> };
> #endif
>
> +#ifdef CONFIG_UBIFS_FS_LZ4HC
> +static DEFINE_MUTEX(lz4hc_mutex);
> +
> +static struct ubifs_compressor lz4hc_compr = {
> + .compr_type = UBIFS_COMPR_LZ4HC,
> + .comp_mutex = &lz4hc_mutex,
> + .name = "lz4hc",
> + .capi_name = "lz4hc",
> +};
> +#else
> +static struct ubifs_compressor lz4hc_compr = {
> + .compr_type = UBIFS_COMPR_LZ4HC,
> + .name = "lz4hc",
> +};
> +#endif
> +
> #ifdef CONFIG_UBIFS_FS_ZLIB
> static DEFINE_MUTEX(deflate_mutex);
> static DEFINE_MUTEX(inflate_mutex);
> @@ -224,10 +240,14 @@
> {
> int err;
>
> - err = compr_init(&lzo_compr);
> + err = compr_init(&lz4hc_compr);
> if (err)
> return err;
>
> + err = compr_init(&lzo_compr);
> + if (err)
> + goto out_lz4hc;
> +
> err = compr_init(&zlib_compr);
> if (err)
> goto out_lzo;
> @@ -237,6 +257,8 @@
>
> out_lzo:
> compr_exit(&lzo_compr);
> +out_lz4hc:
> + compr_exit(&lz4hc_compr);
> return err;
> }
>
> @@ -245,6 +267,7 @@
> */
> void ubifs_compressors_exit(void)
> {
> + compr_exit(&lz4hc_compr);
> compr_exit(&lzo_compr);
> compr_exit(&zlib_compr);
> }
> diff -uN -uNr linux-3.12-rc3.orig/fs/ubifs/Kconfig
> linux-3.12-rc3/fs/ubifs/Kconfig
> --- linux-3.12-rc3.orig/fs/ubifs/Kconfig 2013-09-29
> 17:02:38.000000000 -0500
> +++ linux-3.12-rc3/fs/ubifs/Kconfig 2013-10-03 21:40:39.098747630 -0500
> @@ -29,6 +29,14 @@
> LZO compressor is generally faster than zlib but compresses worse.
> Say 'Y' if unsure.
>
> +config UBIFS_FS_LZ4HC
> + bool "LZ4HC compression support" if UBIFS_FS_ADVANCED_COMPR
> + depends on UBIFS_FS && CRYPTO_LZ4HC
> + default y
> + help
> + LZ4HC compressor is generally faster than zlib but compresses worse.
> + Say 'Y' if unsure.
> +
> config UBIFS_FS_ZLIB
> bool "ZLIB compression support" if UBIFS_FS_ADVANCED_COMPR
> depends on UBIFS_FS
> diff -uN -uNr linux-3.12-rc3.orig/fs/ubifs/super.c
> linux-3.12-rc3/fs/ubifs/super.c
> --- linux-3.12-rc3.orig/fs/ubifs/super.c 2013-09-29
> 17:02:38.000000000 -0500
> +++ linux-3.12-rc3/fs/ubifs/super.c 2013-09-30 23:01:06.899526709 -0500
> @@ -1040,6 +1040,8 @@
> return -ENOMEM;
> if (!strcmp(name, "none"))
> c->mount_opts.compr_type = UBIFS_COMPR_NONE;
> + else if (!strcmp(name, "lz4hc"))
> + c->mount_opts.compr_type = UBIFS_COMPR_LZ4HC;
> else if (!strcmp(name, "lzo"))
> c->mount_opts.compr_type = UBIFS_COMPR_LZO;
> else if (!strcmp(name, "zlib"))
> diff -uN -uNr linux-3.12-rc3.orig/fs/ubifs/ubifs-media.h
> linux-3.12-rc3/fs/ubifs/ubifs-media.h
> --- linux-3.12-rc3.orig/fs/ubifs/ubifs-media.h 2013-09-29
> 17:02:38.000000000 -0500
> +++ linux-3.12-rc3/fs/ubifs/ubifs-media.h 2013-07-16
> 22:56:02.435523610 -0500
> @@ -332,12 +332,14 @@
> * UBIFS_COMPR_NONE: no compression
> * UBIFS_COMPR_LZO: LZO compression
> * UBIFS_COMPR_ZLIB: ZLIB compression
> + * UBIFS_COMPR_LZ4HZ: LZ4HZ compression
> * UBIFS_COMPR_TYPES_CNT: count of supported compression types
> */
> enum {
> UBIFS_COMPR_NONE,
> UBIFS_COMPR_LZO,
> UBIFS_COMPR_ZLIB,
> + UBIFS_COMPR_LZ4HC,
> UBIFS_COMPR_TYPES_CNT,
> };
>
> Enjoy,
> Brent Taylor
--
Regards,
Konstantin
next prev parent reply other threads:[~2013-10-04 8:06 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 [this message]
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
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=409951380873962@web7m.yandex.ru \
--to=annulen@yandex.ru \
--cc=dedekind1@gmail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=motobud@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