[PATCH v3 5/7] zram: delete custom lzo/lz4

2016-06-03 Thread Sergey Senozhatsky
Remove lzo/lz4 backends, we use crypto API now.

Signed-off-by: Sergey Senozhatsky 
Cc: Minchan Kim 
Cc: Joonsoo Kim 
Acked-by: Minchan Kim 
---
 drivers/block/zram/Kconfig |  9 ---
 drivers/block/zram/Makefile|  4 +--
 drivers/block/zram/zcomp.c |  2 +-
 drivers/block/zram/zcomp.h | 15 ---
 drivers/block/zram/zcomp_lz4.c | 56 --
 drivers/block/zram/zcomp_lz4.h | 17 -
 drivers/block/zram/zcomp_lzo.c | 56 --
 drivers/block/zram/zcomp_lzo.h | 17 -
 8 files changed, 2 insertions(+), 174 deletions(-)
 delete mode 100644 drivers/block/zram/zcomp_lz4.c
 delete mode 100644 drivers/block/zram/zcomp_lz4.h
 delete mode 100644 drivers/block/zram/zcomp_lzo.c
 delete mode 100644 drivers/block/zram/zcomp_lzo.h

diff --git a/drivers/block/zram/Kconfig b/drivers/block/zram/Kconfig
index 2252cd7..b8ecba6 100644
--- a/drivers/block/zram/Kconfig
+++ b/drivers/block/zram/Kconfig
@@ -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.
diff --git a/drivers/block/zram/Makefile b/drivers/block/zram/Makefile
index be0763f..9e2b79e 100644
--- a/drivers/block/zram/Makefile
+++ b/drivers/block/zram/Makefile
@@ -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
diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c
index a2b4eb8..9ab45d4 100644
--- a/drivers/block/zram/zcomp.c
+++ b/drivers/block/zram/zcomp.c
@@ -20,7 +20,7 @@
 
 static const char * const backends[] = {
"lzo",
-#ifdef CONFIG_ZRAM_LZ4_COMPRESS
+#if IS_ENABLED(CONFIG_CRYPTO_LZ4)
"lz4",
 #endif
NULL
diff --git a/drivers/block/zram/zcomp.h b/drivers/block/zram/zcomp.h
index c914ab7..478cac2 100644
--- a/drivers/block/zram/zcomp.h
+++ b/drivers/block/zram/zcomp.h
@@ -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
index 0110086..000
--- a/drivers/block/zram/zcomp_lz4.c
+++ /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 
-#include 
-#include 
-#include 
-#include 
-
-#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, _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
index 60613fb..000
--- a/drivers/block/zram/zcomp_lz4.h
+++ /dev/null
@@ 

[PATCH v3 5/7] zram: delete custom lzo/lz4

2016-06-03 Thread Sergey Senozhatsky
Remove lzo/lz4 backends, we use crypto API now.

Signed-off-by: Sergey Senozhatsky 
Cc: Minchan Kim 
Cc: Joonsoo Kim 
Acked-by: Minchan Kim 
---
 drivers/block/zram/Kconfig |  9 ---
 drivers/block/zram/Makefile|  4 +--
 drivers/block/zram/zcomp.c |  2 +-
 drivers/block/zram/zcomp.h | 15 ---
 drivers/block/zram/zcomp_lz4.c | 56 --
 drivers/block/zram/zcomp_lz4.h | 17 -
 drivers/block/zram/zcomp_lzo.c | 56 --
 drivers/block/zram/zcomp_lzo.h | 17 -
 8 files changed, 2 insertions(+), 174 deletions(-)
 delete mode 100644 drivers/block/zram/zcomp_lz4.c
 delete mode 100644 drivers/block/zram/zcomp_lz4.h
 delete mode 100644 drivers/block/zram/zcomp_lzo.c
 delete mode 100644 drivers/block/zram/zcomp_lzo.h

diff --git a/drivers/block/zram/Kconfig b/drivers/block/zram/Kconfig
index 2252cd7..b8ecba6 100644
--- a/drivers/block/zram/Kconfig
+++ b/drivers/block/zram/Kconfig
@@ -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.
diff --git a/drivers/block/zram/Makefile b/drivers/block/zram/Makefile
index be0763f..9e2b79e 100644
--- a/drivers/block/zram/Makefile
+++ b/drivers/block/zram/Makefile
@@ -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
diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c
index a2b4eb8..9ab45d4 100644
--- a/drivers/block/zram/zcomp.c
+++ b/drivers/block/zram/zcomp.c
@@ -20,7 +20,7 @@
 
 static const char * const backends[] = {
"lzo",
-#ifdef CONFIG_ZRAM_LZ4_COMPRESS
+#if IS_ENABLED(CONFIG_CRYPTO_LZ4)
"lz4",
 #endif
NULL
diff --git a/drivers/block/zram/zcomp.h b/drivers/block/zram/zcomp.h
index c914ab7..478cac2 100644
--- a/drivers/block/zram/zcomp.h
+++ b/drivers/block/zram/zcomp.h
@@ -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
index 0110086..000
--- a/drivers/block/zram/zcomp_lz4.c
+++ /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 
-#include 
-#include 
-#include 
-#include 
-
-#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, _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
index 60613fb..000
--- a/drivers/block/zram/zcomp_lz4.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright (C) 2014 Sergey Senozhatsky.
- *
- * This program is free