Add zstd.diff

dev
Nick Terrell 2017-05-16 15:54:02 -07:00
parent b3ebe9b77c
commit 1d42ca8f6d
4 changed files with 12596 additions and 5 deletions

View File

@ -1,21 +1,33 @@
# Linux Kernel Patch
There are three pieces, the `zstd_compress` and `zstd_decompress` kernel modules, the BtrFS patch, and the SquashFS patch.
There are four pieces, the `xxhash` kernel module, the `zstd_compress` and `zstd_decompress` kernel modules, the BtrFS patch, and the SquashFS patch.
The patches are based off of the linux kernel master branch (version 4.10).
## xxHash kernel module
* The patch is locaed in `xxhash.diff`.
* The header is in `include/linux/xxhash.h`.
* The source is in `lib/xxhash.c`.
* `test/XXHashUserLandTest.cpp` contains tests for the patch in userland by mocking the kernel headers.
I tested the tests by commenting a line of of each branch in `xxhash.c` one line at a time, and made sure the tests failed.
It can be run with the following commands:
```
cd test && make googletest && make XXHashUserLandTest && ./XXHashUserLandTest
```
* I also benchmarked the `xxhash` module against upstream xxHash, and made sure that they ran at the same speed.
## Zstd Kernel modules
* The (large) patch is locaed in `zstd.diff`, which depends on `xxhash.diff`.
* The header is in `include/linux/zstd.h`.
* It is split up into `zstd_compress` and `zstd_decompress`, which can be loaded independently.
* Source files are in `lib/zstd/`.
* `lib/Kconfig` and `lib/Makefile` need to be modified by applying `lib/Kconfig.diff` and `lib/Makefile.diff` respectively.
These changes are also included in the `zstd.diff`.
* `test/UserlandTest.cpp` contains tests for the patch in userland by mocking the kernel headers.
It can be run with the following commands:
```
cd test
make googletest
make UserlandTest
./UserlandTest
cd test && make googletest && make UserlandTest && ./UserlandTest
```
## BtrFS

View File

@ -0,0 +1,19 @@
diff --git a/lib/Kconfig b/lib/Kconfig
index b6009d7..f00ddab 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -241,6 +241,14 @@ config LZ4HC_COMPRESS
config LZ4_DECOMPRESS
tristate
+config ZSTD_COMPRESS
+ select XXHASH
+ tristate
+
+config ZSTD_DECOMPRESS
+ select XXHASH
+ tristate
+
source "lib/xz/Kconfig"
#

View File

@ -0,0 +1,13 @@
diff --git a/lib/Makefile b/lib/Makefile
index e16f94a..0cfd529 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -115,6 +115,8 @@ obj-$(CONFIG_LZO_DECOMPRESS) += lzo/
obj-$(CONFIG_LZ4_COMPRESS) += lz4/
obj-$(CONFIG_LZ4HC_COMPRESS) += lz4/
obj-$(CONFIG_LZ4_DECOMPRESS) += lz4/
+obj-$(CONFIG_ZSTD_COMPRESS) += zstd/
+obj-$(CONFIG_ZSTD_DECOMPRESS) += zstd/
obj-$(CONFIG_XZ_DEC) += xz/
obj-$(CONFIG_RAID6_PQ) += raid6/

12547
contrib/linux-kernel/zstd.diff Normal file

File diff suppressed because it is too large Load Diff