diff options
| author | Sergey Senozhatsky <sergey.senozhatsky@gmail.com> | 2015-06-25 15:00:32 -0700 |
|---|---|---|
| committer | Mister Oyster <oysterized@gmail.com> | 2017-09-25 20:40:44 +0200 |
| commit | 777d82fc14ed8782f93f9ee908f25b07eaa98dd6 (patch) | |
| tree | 2a06e4c6ccb156c31e7097ad30ef4d90a636d11f /include | |
| parent | 857b3f24a051a0e49ce03b5b9b0b41b6d0f88964 (diff) | |
zram: check comp algorithm availability earlier
Improvement idea by Marcin Jabrzyk.
comp_algorithm_store() silently accepts any supplied algorithm name,
because zram performs algorithm availability check later, during the
device configuration phase in disksize_store() and emits the following
error:
"zram: Cannot initialise %s compressing backend"
this error line is somewhat generic and, besides, can indicate a failed
attempt to allocate compression backend's working buffers.
add algorithm availability check to comp_algorithm_store():
echo lzz > /sys/block/zram0/comp_algorithm
-bash: echo: write error: Invalid argument
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Reported-by: Marcin Jabrzyk <m.jabrzyk@samsung.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/zcomp.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/zcomp.h b/include/linux/zcomp.h index c59d1fca7..46e2b9f8f 100644 --- a/include/linux/zcomp.h +++ b/include/linux/zcomp.h @@ -51,6 +51,7 @@ struct zcomp { }; ssize_t zcomp_available_show(const char *comp, char *buf); +bool zcomp_available_algorithm(const char *comp); struct zcomp *zcomp_create(const char *comp, int max_strm); void zcomp_destroy(struct zcomp *comp); |
