UPSTREAM: zram: delete custom lzo/lz4
authorSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Tue, 26 Jul 2016 22:22:54 +0000 (15:22 -0700)
committerMichael Benedict <michaelbt@live.com>
Fri, 30 Aug 2019 07:40:48 +0000 (17:40 +1000)
Remove lzo/lz4 backends, we use crypto API now.

[sergey.senozhatsky@gmail.com: zram-delete-custom-lzo-lz4-v3]
Link: http://lkml.kernel.org/r/20160604024902.11778-6-sergey.senozhatsky@gmail.com
Link: http://lkml.kernel.org/r/20160531122017.2878-7-sergey.senozhatsky@gmail.com
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit ce1ed9f98e888aa220fb09da2e2bcfcfba218a27)
Signed-off-by: Peter Kalauskas <peskal@google.com>
Bug: 112488418
Change-Id: Ic2aa300a1a66b61740da73833dab252dc0d4b74a

drivers/block/zram/Kconfig
drivers/block/zram/Makefile
drivers/block/zram/zcomp.c
drivers/block/zram/zcomp.h
drivers/block/zram/zcomp_lz4.c [deleted file]
drivers/block/zram/zcomp_lz4.h [deleted file]
drivers/block/zram/zcomp_lzo.c [deleted file]
drivers/block/zram/zcomp_lzo.h [deleted file]

index 2252cd7d0e89d90db7fe6dd827b7cfcbd4b4862c..b8ecba6dcd3b8669b01cc537a0027f86e2d8b10c 100644 (file)
@@ -13,12 +13,3 @@ config ZRAM
          disks and maybe many more.
 
          See zram.txt for more information.
-
-config ZRAM_LZ4_COMPRESS
-       bool "Enable LZ4 algorithm support"
-       depends on ZRAM
-       select CRYPTO_LZ4
-       default n
-       help
-         This option enables LZ4 compression algorithm support. Compression
-         algorithm can be changed using `comp_algorithm' device attribute.
index be0763ff57a2b6bc5c21d7003cf53db75219ee0e..9e2b79e9a990b59ecc7868dd78ae1cc5cd13a595 100644 (file)
@@ -1,5 +1,3 @@
-zram-y :=      zcomp_lzo.o zcomp.o zram_drv.o
-
-zram-$(CONFIG_ZRAM_LZ4_COMPRESS) += zcomp_lz4.o
+zram-y :=      zcomp.o zram_drv.o
 
 obj-$(CONFIG_ZRAM)     +=      zram.o
index a2b4eb85b41d47f7bcab4f0d8622b2439eaf9777..9ab45d41624b0a9b4556dc457202e33fa17745f5 100644 (file)
@@ -20,7 +20,7 @@
 
 static const char * const backends[] = {
        "lzo",
-#ifdef CONFIG_ZRAM_LZ4_COMPRESS
+#if IS_ENABLED(CONFIG_CRYPTO_LZ4)
        "lz4",
 #endif
        NULL
index c914ab7972ef7374e0adf9474afafb32841514fd..478cac2ed46569c416c1474c4a007a2653f85a6d 100644 (file)
@@ -16,24 +16,9 @@ struct zcomp_strm {
        struct crypto_comp *tfm;
 };
 
-/* static compression backend */
-struct zcomp_backend {
-       int (*compress)(const unsigned char *src, unsigned char *dst,
-                       size_t *dst_len, void *private);
-
-       int (*decompress)(const unsigned char *src, size_t src_len,
-                       unsigned char *dst);
-
-       void *(*create)(gfp_t flags);
-       void (*destroy)(void *private);
-
-       const char *name;
-};
-
 /* dynamic per-device compression frontend */
 struct zcomp {
        struct zcomp_strm * __percpu *stream;
-       struct zcomp_backend *backend;
        struct notifier_block notifier;
 
        const char *name;
diff --git a/drivers/block/zram/zcomp_lz4.c b/drivers/block/zram/zcomp_lz4.c
deleted file mode 100644 (file)
index 0110086..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2014 Sergey Senozhatsky.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/lz4.h>
-#include <linux/vmalloc.h>
-#include <linux/mm.h>
-
-#include "zcomp_lz4.h"
-
-static void *zcomp_lz4_create(gfp_t flags)
-{
-       void *ret;
-
-       ret = kmalloc(LZ4_MEM_COMPRESS, flags);
-       if (!ret)
-               ret = __vmalloc(LZ4_MEM_COMPRESS,
-                               flags | __GFP_HIGHMEM,
-                               PAGE_KERNEL);
-       return ret;
-}
-
-static void zcomp_lz4_destroy(void *private)
-{
-       kvfree(private);
-}
-
-static int zcomp_lz4_compress(const unsigned char *src, unsigned char *dst,
-               size_t *dst_len, void *private)
-{
-       /* return  : Success if return 0 */
-       return lz4_compress(src, PAGE_SIZE, dst, dst_len, private);
-}
-
-static int zcomp_lz4_decompress(const unsigned char *src, size_t src_len,
-               unsigned char *dst)
-{
-       size_t dst_len = PAGE_SIZE;
-       /* return  : Success if return 0 */
-       return lz4_decompress_unknownoutputsize(src, src_len, dst, &dst_len);
-}
-
-struct zcomp_backend zcomp_lz4 = {
-       .compress = zcomp_lz4_compress,
-       .decompress = zcomp_lz4_decompress,
-       .create = zcomp_lz4_create,
-       .destroy = zcomp_lz4_destroy,
-       .name = "lz4",
-};
diff --git a/drivers/block/zram/zcomp_lz4.h b/drivers/block/zram/zcomp_lz4.h
deleted file mode 100644 (file)
index 60613fb..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright (C) 2014 Sergey Senozhatsky.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-
-#ifndef _ZCOMP_LZ4_H_
-#define _ZCOMP_LZ4_H_
-
-#include "zcomp.h"
-
-extern struct zcomp_backend zcomp_lz4;
-
-#endif /* _ZCOMP_LZ4_H_ */
diff --git a/drivers/block/zram/zcomp_lzo.c b/drivers/block/zram/zcomp_lzo.c
deleted file mode 100644 (file)
index ed7a1f0..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2014 Sergey Senozhatsky.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/lzo.h>
-#include <linux/vmalloc.h>
-#include <linux/mm.h>
-
-#include "zcomp_lzo.h"
-
-static void *lzo_create(gfp_t flags)
-{
-       void *ret;
-
-       ret = kmalloc(LZO1X_MEM_COMPRESS, flags);
-       if (!ret)
-               ret = __vmalloc(LZO1X_MEM_COMPRESS,
-                               flags | __GFP_HIGHMEM,
-                               PAGE_KERNEL);
-       return ret;
-}
-
-static void lzo_destroy(void *private)
-{
-       kvfree(private);
-}
-
-static int lzo_compress(const unsigned char *src, unsigned char *dst,
-               size_t *dst_len, void *private)
-{
-       int ret = lzo1x_1_compress(src, PAGE_SIZE, dst, dst_len, private);
-       return ret == LZO_E_OK ? 0 : ret;
-}
-
-static int lzo_decompress(const unsigned char *src, size_t src_len,
-               unsigned char *dst)
-{
-       size_t dst_len = PAGE_SIZE;
-       int ret = lzo1x_decompress_safe(src, src_len, dst, &dst_len);
-       return ret == LZO_E_OK ? 0 : ret;
-}
-
-struct zcomp_backend zcomp_lzo = {
-       .compress = lzo_compress,
-       .decompress = lzo_decompress,
-       .create = lzo_create,
-       .destroy = lzo_destroy,
-       .name = "lzo",
-};
diff --git a/drivers/block/zram/zcomp_lzo.h b/drivers/block/zram/zcomp_lzo.h
deleted file mode 100644 (file)
index 128c580..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright (C) 2014 Sergey Senozhatsky.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-
-#ifndef _ZCOMP_LZO_H_
-#define _ZCOMP_LZO_H_
-
-#include "zcomp.h"
-
-extern struct zcomp_backend zcomp_lzo;
-
-#endif /* _ZCOMP_LZO_H_ */