summaryrefslogtreecommitdiffstats
path: root/drivers/block/zram/zcomp.c
diff options
context:
space:
mode:
authorSergey Senozhatsky <senozhatsky@chromium.org>2024-09-02 12:56:01 +0200
committerAndrew Morton <akpm@linux-foundation.org>2024-09-10 01:39:09 +0200
commitf2bac7ad187d77e2a053d3cd04b158a06b683d26 (patch)
tree5239c4e793ff631fd64be9cb18e433f32724d1d6 /drivers/block/zram/zcomp.c
parentzram: check that backends array has at least one backend (diff)
downloadlinux-f2bac7ad187d77e2a053d3cd04b158a06b683d26.tar.xz
linux-f2bac7ad187d77e2a053d3cd04b158a06b683d26.zip
zram: introduce zcomp_params structure
We will store a per-algorithm parameters there (compression level, dictionary, dictionary size, etc.). Link: https://lkml.kernel.org/r/20240902105656.1383858-14-senozhatsky@chromium.org Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org> Cc: Minchan Kim <minchan@kernel.org> Cc: Nick Terrell <terrelln@fb.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'drivers/block/zram/zcomp.c')
-rw-r--r--drivers/block/zram/zcomp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c
index 76d21ee77067..173ee2b79442 100644
--- a/drivers/block/zram/zcomp.c
+++ b/drivers/block/zram/zcomp.c
@@ -54,7 +54,7 @@ static void zcomp_strm_free(struct zcomp *comp, struct zcomp_strm *zstrm)
static int zcomp_strm_init(struct zcomp *comp, struct zcomp_strm *zstrm)
{
- zstrm->ctx = comp->ops->create_ctx();
+ zstrm->ctx = comp->ops->create_ctx(comp->params);
/*
* allocate 2 pages. 1 for compressed data, plus 1 extra for the
@@ -187,7 +187,7 @@ void zcomp_destroy(struct zcomp *comp)
kfree(comp);
}
-struct zcomp *zcomp_create(const char *alg)
+struct zcomp *zcomp_create(const char *alg, struct zcomp_params *params)
{
struct zcomp *comp;
int error;
@@ -204,6 +204,7 @@ struct zcomp *zcomp_create(const char *alg)
if (!comp)
return ERR_PTR(-ENOMEM);
+ comp->params = params;
comp->ops = lookup_backend_ops(alg);
if (!comp->ops) {
kfree(comp);