Skip to content

Commit 7a29350

Browse files
Haoqin Huangkernel-patches-daemon
authored andcommitted
zram: reset per-priority params when changing algorithm before init
Parameters validated against one algorithm may be invalid for another (e.g. lz4 accepts level=65535 but zstd does not). Although algorithm changes are blocked after disksize is set, they are allowed before device initialization. Reset per-priority params on algorithm change so that stale parameters do not silently carry over. Signed-off-by: Haoqin Huang <haoqinhuang@tencent.com> Reviewed-by: Rongwei Wang <zigiwang@tencent.com>
1 parent a7c0458 commit 7a29350

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/block/zram/zram_drv.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ static size_t huge_class_size;
5757
static const struct block_device_operations zram_devops;
5858

5959
static void slot_free(struct zram *zram, u32 index);
60+
static void comp_params_reset(struct zram *zram, u32 prio);
6061
#define slot_dep_map(zram, index) (&(zram)->table[(index)].dep_map)
6162

6263
static void slot_lock_init(struct zram *zram, u32 index)
@@ -1681,6 +1682,7 @@ static int __comp_algorithm_store(struct zram *zram, u32 prio, const char *buf)
16811682
}
16821683

16831684
comp_algorithm_set(zram, prio, alg);
1685+
comp_params_reset(zram, prio);
16841686
return 0;
16851687
}
16861688

0 commit comments

Comments
 (0)