diff options
author | Sergey Senozhatsky <sergey.senozhatsky@gmail.com> | 2016-07-26 18:22:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-07-26 19:19:19 -0400 |
commit | ce1ed9f98e888aa220fb09da2e2bcfcfba218a27 (patch) | |
tree | 67d79b4c62b0db0e4732ddba6f720c8c0a6cc021 | |
parent | 69a30a8d2ac17c8080cf6ebfc91149fd6c2648b3 (diff) |
zram: delete custom lzo/lz4
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>
-rw-r--r-- | drivers/block/zram/Kconfig | 9 | ||||
-rw-r--r-- | drivers/block/zram/Makefile | 4 | ||||
-rw-r--r-- | drivers/block/zram/zcomp.c | 2 | ||||
-rw-r--r-- | drivers/block/zram/zcomp.h | 15 | ||||
-rw-r--r-- | drivers/block/zram/zcomp_lz4.c | 56 | ||||
-rw-r--r-- | drivers/block/zram/zcomp_lz4.h | 17 | ||||
-rw-r--r-- | drivers/block/zram/zcomp_lzo.c | 56 | ||||
-rw-r--r-- | drivers/block/zram/zcomp_lzo.h | 17 |
8 files changed, 2 insertions, 174 deletions
diff --git a/drivers/block/zram/Kconfig b/drivers/block/zram/Kconfig index 2252cd7d0e89..b8ecba6dcd3b 100644 --- a/drivers/block/zram/Kconfig +++ b/drivers/block/zram/Kconfig | |||
@@ -13,12 +13,3 @@ config ZRAM | |||
13 | disks and maybe many more. | 13 | disks and maybe many more. |
14 | 14 | ||
15 | See zram.txt for more information. | 15 | See zram.txt for more information. |
16 | |||
17 | config ZRAM_LZ4_COMPRESS | ||
18 | bool "Enable LZ4 algorithm support" | ||
19 | depends on ZRAM | ||
20 | select CRYPTO_LZ4 | ||
21 | default n | ||
22 | help | ||
23 | This option enables LZ4 compression algorithm support. Compression | ||
24 | algorithm can be changed using `comp_algorithm' device attribute. | ||
diff --git a/drivers/block/zram/Makefile b/drivers/block/zram/Makefile index be0763ff57a2..9e2b79e9a990 100644 --- a/drivers/block/zram/Makefile +++ b/drivers/block/zram/Makefile | |||
@@ -1,5 +1,3 @@ | |||
1 | zram-y := zcomp_lzo.o zcomp.o zram_drv.o | 1 | zram-y := zcomp.o zram_drv.o |
2 | |||
3 | zram-$(CONFIG_ZRAM_LZ4_COMPRESS) += zcomp_lz4.o | ||
4 | 2 | ||
5 | obj-$(CONFIG_ZRAM) += zram.o | 3 | obj-$(CONFIG_ZRAM) += zram.o |
diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c index a2b4eb85b41d..9ab45d41624b 100644 --- a/drivers/block/zram/zcomp.c +++ b/drivers/block/zram/zcomp.c | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | static const char * const backends[] = { | 21 | static const char * const backends[] = { |
22 | "lzo", | 22 | "lzo", |
23 | #ifdef CONFIG_ZRAM_LZ4_COMPRESS | 23 | #if IS_ENABLED(CONFIG_CRYPTO_LZ4) |
24 | "lz4", | 24 | "lz4", |
25 | #endif | 25 | #endif |
26 | NULL | 26 | NULL |
diff --git a/drivers/block/zram/zcomp.h b/drivers/block/zram/zcomp.h index c914ab7972ef..478cac2ed465 100644 --- a/drivers/block/zram/zcomp.h +++ b/drivers/block/zram/zcomp.h | |||
@@ -16,24 +16,9 @@ struct zcomp_strm { | |||
16 | struct crypto_comp *tfm; | 16 | struct crypto_comp *tfm; |
17 | }; | 17 | }; |
18 | 18 | ||
19 | /* static compression backend */ | ||
20 | struct zcomp_backend { | ||
21 | int (*compress)(const unsigned char *src, unsigned char *dst, | ||
22 | size_t *dst_len, void *private); | ||
23 | |||
24 | int (*decompress)(const unsigned char *src, size_t src_len, | ||
25 | unsigned char *dst); | ||
26 | |||
27 | void *(*create)(gfp_t flags); | ||
28 | void (*destroy)(void *private); | ||
29 | |||
30 | const char *name; | ||
31 | }; | ||
32 | |||
33 | /* dynamic per-device compression frontend */ | 19 | /* dynamic per-device compression frontend */ |
34 | struct zcomp { | 20 | struct zcomp { |
35 | struct zcomp_strm * __percpu *stream; | 21 | struct zcomp_strm * __percpu *stream; |
36 | struct zcomp_backend *backend; | ||
37 | struct notifier_block notifier; | 22 | struct notifier_block notifier; |
38 | 23 | ||
39 | const char *name; | 24 | const char *name; |
diff --git a/drivers/block/zram/zcomp_lz4.c b/drivers/block/zram/zcomp_lz4.c deleted file mode 100644 index 0110086accba..000000000000 --- a/drivers/block/zram/zcomp_lz4.c +++ /dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014 Sergey Senozhatsky. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | */ | ||
9 | |||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/slab.h> | ||
12 | #include <linux/lz4.h> | ||
13 | #include <linux/vmalloc.h> | ||
14 | #include <linux/mm.h> | ||
15 | |||
16 | #include "zcomp_lz4.h" | ||
17 | |||
18 | static void *zcomp_lz4_create(gfp_t flags) | ||
19 | { | ||
20 | void *ret; | ||
21 | |||
22 | ret = kmalloc(LZ4_MEM_COMPRESS, flags); | ||
23 | if (!ret) | ||
24 | ret = __vmalloc(LZ4_MEM_COMPRESS, | ||
25 | flags | __GFP_HIGHMEM, | ||
26 | PAGE_KERNEL); | ||
27 | return ret; | ||
28 | } | ||
29 | |||
30 | static void zcomp_lz4_destroy(void *private) | ||
31 | { | ||
32 | kvfree(private); | ||
33 | } | ||
34 | |||
35 | static int zcomp_lz4_compress(const unsigned char *src, unsigned char *dst, | ||
36 | size_t *dst_len, void *private) | ||
37 | { | ||
38 | /* return : Success if return 0 */ | ||
39 | return lz4_compress(src, PAGE_SIZE, dst, dst_len, private); | ||
40 | } | ||
41 | |||
42 | static int zcomp_lz4_decompress(const unsigned char *src, size_t src_len, | ||
43 | unsigned char *dst) | ||
44 | { | ||
45 | size_t dst_len = PAGE_SIZE; | ||
46 | /* return : Success if return 0 */ | ||
47 | return lz4_decompress_unknownoutputsize(src, src_len, dst, &dst_len); | ||
48 | } | ||
49 | |||
50 | struct zcomp_backend zcomp_lz4 = { | ||
51 | .compress = zcomp_lz4_compress, | ||
52 | .decompress = zcomp_lz4_decompress, | ||
53 | .create = zcomp_lz4_create, | ||
54 | .destroy = zcomp_lz4_destroy, | ||
55 | .name = "lz4", | ||
56 | }; | ||
diff --git a/drivers/block/zram/zcomp_lz4.h b/drivers/block/zram/zcomp_lz4.h deleted file mode 100644 index 60613fb29dd8..000000000000 --- a/drivers/block/zram/zcomp_lz4.h +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014 Sergey Senozhatsky. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | */ | ||
9 | |||
10 | #ifndef _ZCOMP_LZ4_H_ | ||
11 | #define _ZCOMP_LZ4_H_ | ||
12 | |||
13 | #include "zcomp.h" | ||
14 | |||
15 | extern struct zcomp_backend zcomp_lz4; | ||
16 | |||
17 | #endif /* _ZCOMP_LZ4_H_ */ | ||
diff --git a/drivers/block/zram/zcomp_lzo.c b/drivers/block/zram/zcomp_lzo.c deleted file mode 100644 index ed7a1f0549ec..000000000000 --- a/drivers/block/zram/zcomp_lzo.c +++ /dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014 Sergey Senozhatsky. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | */ | ||
9 | |||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/slab.h> | ||
12 | #include <linux/lzo.h> | ||
13 | #include <linux/vmalloc.h> | ||
14 | #include <linux/mm.h> | ||
15 | |||
16 | #include "zcomp_lzo.h" | ||
17 | |||
18 | static void *lzo_create(gfp_t flags) | ||
19 | { | ||
20 | void *ret; | ||
21 | |||
22 | ret = kmalloc(LZO1X_MEM_COMPRESS, flags); | ||
23 | if (!ret) | ||
24 | ret = __vmalloc(LZO1X_MEM_COMPRESS, | ||
25 | flags | __GFP_HIGHMEM, | ||
26 | PAGE_KERNEL); | ||
27 | return ret; | ||
28 | } | ||
29 | |||
30 | static void lzo_destroy(void *private) | ||
31 | { | ||
32 | kvfree(private); | ||
33 | } | ||
34 | |||
35 | static int lzo_compress(const unsigned char *src, unsigned char *dst, | ||
36 | size_t *dst_len, void *private) | ||
37 | { | ||
38 | int ret = lzo1x_1_compress(src, PAGE_SIZE, dst, dst_len, private); | ||
39 | return ret == LZO_E_OK ? 0 : ret; | ||
40 | } | ||
41 | |||
42 | static int lzo_decompress(const unsigned char *src, size_t src_len, | ||
43 | unsigned char *dst) | ||
44 | { | ||
45 | size_t dst_len = PAGE_SIZE; | ||
46 | int ret = lzo1x_decompress_safe(src, src_len, dst, &dst_len); | ||
47 | return ret == LZO_E_OK ? 0 : ret; | ||
48 | } | ||
49 | |||
50 | struct zcomp_backend zcomp_lzo = { | ||
51 | .compress = lzo_compress, | ||
52 | .decompress = lzo_decompress, | ||
53 | .create = lzo_create, | ||
54 | .destroy = lzo_destroy, | ||
55 | .name = "lzo", | ||
56 | }; | ||
diff --git a/drivers/block/zram/zcomp_lzo.h b/drivers/block/zram/zcomp_lzo.h deleted file mode 100644 index 128c5807fa14..000000000000 --- a/drivers/block/zram/zcomp_lzo.h +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014 Sergey Senozhatsky. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | */ | ||
9 | |||
10 | #ifndef _ZCOMP_LZO_H_ | ||
11 | #define _ZCOMP_LZO_H_ | ||
12 | |||
13 | #include "zcomp.h" | ||
14 | |||
15 | extern struct zcomp_backend zcomp_lzo; | ||
16 | |||
17 | #endif /* _ZCOMP_LZO_H_ */ | ||