Re: [PATCH v4 4/4] zram: reset per-priority params when changing algorithm before init

From: Sergey Senozhatsky

Date: Thu Jul 30 2026 - 03:40:33 EST


On (26/07/30 14:01), Haoqin Huang wrote:
[..]
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index 0223fd83bbba..814f0af4d77d 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -1661,6 +1661,8 @@ static void comp_algorithm_set(struct zram *zram, u32 prio, const char *alg)
> zram->comp_algs[prio] = alg;
> }
>
> +static void comp_params_reset(struct zram *zram, u32 prio);

Or maybe just move that function up. I guess that's better than
forward declarations.

> static int __comp_algorithm_store(struct zram *zram, u32 prio, const char *buf)
> {
> const char *alg;
> @@ -1681,6 +1683,7 @@ static int __comp_algorithm_store(struct zram *zram, u32 prio, const char *buf)
> }
>
> comp_algorithm_set(zram, prio, alg);
> + comp_params_reset(zram, prio);
> return 0;
> }