Re: [PATCH 7/7] lib/lzo: separate lzo-rle from lzo

From: Dave Rodgman
Date: Thu Nov 29 2018 - 05:22:05 EST




On 29/11/2018 4:43 am, Sergey Senozhatsky wrote:
> On (11/27/18 16:19), Dave Rodgman wrote:
>> Documentation/lzo.txt | 12 ++-
>> crypto/Makefile | 2 +-
>> crypto/lzo-rle.c | 175 ++++++++++++++++++++++++++++++++++++++++++
>> crypto/tcrypt.c | 4 +-
>> drivers/block/zram/zcomp.c | 1 +
>> drivers/block/zram/zram_drv.c | 2 +-
>> include/linux/lzo.h | 4 +
>> lib/lzo/lzo1x_compress.c | 42 +++++++---
>> lib/lzo/lzodefs.h | 3 +-
>> 9 files changed, 227 insertions(+), 18 deletions(-)
>> create mode 100644 crypto/lzo-rle.c
>
> [..]
>
>> +static struct crypto_alg alg = {
>> + .cra_name = "lzo-rle",
>> + .cra_flags = CRYPTO_ALG_TYPE_COMPRESS,
>> + .cra_ctxsize = sizeof(struct lzorle_ctx),
>> + .cra_module = THIS_MODULE,
>> + .cra_init = lzorle_init,
>> + .cra_exit = lzorle_exit,
>> + .cra_u = { .compress = {
>> + .coa_compress = lzorle_compress,
>> + .coa_decompress = lzorle_decompress } }
>> +};
>
> A nitpick:
> indentation for .compress assignment is a bit confusing, maybe.

Agreed - I've copied this directly from crypto/lzo.c though, so I
retained the same style. Cleanup could be a separate patch.

> [..]
>> +++ b/drivers/block/zram/zcomp.c
>> @@ -20,6 +20,7 @@
>>
>> static const char * const backends[] = {
>> "lzo",
>> + "lzo-rle",
>> #if IS_ENABLED(CONFIG_CRYPTO_LZ4)
>> "lz4",
>> #endif
>
> [..]
>
>> +++ b/drivers/block/zram/zram_drv.c
>> @@ -41,7 +41,7 @@ static DEFINE_IDR(zram_index_idr);
>> static DEFINE_MUTEX(zram_index_mutex);
>>
>> static int zram_major;
>> -static const char *default_compressor = "lzo";
>> +static const char *default_compressor = "lzo-rle";
>
> OK, so it's not just "separate lzo-rle", it's also "switch zram to
> a new compression algorithm by default". I'd say that usually I'd
> expect this to be separate patches.

Yes, fair point. akpm has picked this up now though, so probably a bit
late to break it out into a separate patch?

Dave