Re: [PATCH v5] zram: break the strict dependency from lzo

From: Minchan Kim
Date: Fri Nov 20 2020 - 16:41:04 EST


On Fri, Nov 20, 2020 at 09:10:13AM +0000, Rui Salvaterra wrote:
> Hi, Minchan,
>
> On Thu, 19 Nov 2020 at 22:26, Minchan Kim <minchan@xxxxxxxxxx> wrote:
> >
> > What's the purpose of ZRAM_AUTOSEL_ALGO?
> > If you and Sergey already discussed, sorry about the missing it.
>
> The purpose of ZRAM_AUTOSEL_ALGO is to make sure at least one of the
> required compression algorithms is enabled, either as a module or
> built-in. I believe Sergey agreed with the reasoning behind it, but
> he'll let us know if I misunderstood. :)
>
> > Below doesn't work for your goal?
>
> Unfortunately, it doesn't. :( It breaks the dependency chain, allowing
> you to deselect all compression algorithms in the crypto menu, and

Hi Rui,

I don't understand it. Please see below. ZRAM_COMP_LZO_DEF select
CRYPTO_LZO, not relying on it. If system supports other CRYPTO module
it will show on choice list. Otherwise, default lzo will be always
there and select CRYPTO_LZO.

Do I miss your point?

+
+choice
+ prompt "zram default compressor"
+ default ZRAM_COMP_LZO_DEF
+ depends on ZRAM || CRYPTO_LZ4
+ help
+ a
+
+config ZRAM_COMP_LZO_DEF
+ bool "lzo"
+ select CRYPTO_LZO
+ help
+ b
+
+config ZRAM_COMP_LZ4_DEF
+ bool "lz4"
+ depends on CRYPTO_LZ4
+ help
+ c
+endchoice
+
+config ZRAM_DEF_COMP
+ string
+ default "lzo" if ZRAM_COMP_LZO_DEF
+ default "lz4" if ZRAM_COMP_LZ4_DEF