[linux] Update patches for v3

This commit is contained in:
Nick Terrell
2017-07-20 13:33:55 -07:00
parent b4d460f32c
commit 7d3ac0710d
8 changed files with 105 additions and 126 deletions
@@ -1,7 +1,7 @@
From d2626127c6d6e60e940dd9a3ed58323bdcdc4930 Mon Sep 17 00:00:00 2001
From 686a6149b98250d66b5951e3ae05e79063e9de98 Mon Sep 17 00:00:00 2001
From: Nick Terrell <terrelln@fb.com>
Date: Tue, 16 May 2017 14:55:36 -0700
Subject: [PATCH v2 2/4] lib: Add zstd modules
Date: Mon, 17 Jul 2017 17:08:19 -0700
Subject: [PATCH v3 2/4] lib: Add zstd modules
Add zstd compression and decompression kernel modules.
zstd offers a wide varity of compression speed and quality trade-offs.
@@ -110,6 +110,10 @@ v1 -> v2:
HUF_compressWeights(), HUF_readDTableX2(), and HUF_readDTableX4()
- No function uses more than 400 B of stack space
v2 -> v3:
- Work around gcc-7 bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81388
- Fix bug in dictionary compression from upstream commit cc1522351f
include/linux/zstd.h | 1157 +++++++++++++++
lib/Kconfig | 8 +
lib/Makefile | 2 +
@@ -123,13 +127,13 @@ v1 -> v2:
lib/zstd/fse_compress.c | 795 +++++++++++
lib/zstd/fse_decompress.c | 332 +++++
lib/zstd/huf.h | 212 +++
lib/zstd/huf_compress.c | 771 ++++++++++
lib/zstd/huf_compress.c | 770 ++++++++++
lib/zstd/huf_decompress.c | 960 +++++++++++++
lib/zstd/mem.h | 151 ++
lib/zstd/zstd_common.c | 75 +
lib/zstd/zstd_internal.h | 269 ++++
lib/zstd/zstd_internal.h | 250 ++++
lib/zstd/zstd_opt.h | 1014 +++++++++++++
19 files changed, 13014 insertions(+)
19 files changed, 12994 insertions(+)
create mode 100644 include/linux/zstd.h
create mode 100644 lib/zstd/Makefile
create mode 100644 lib/zstd/bitstream.h
@@ -1312,10 +1316,10 @@ index 0000000..249575e
+
+#endif /* ZSTD_H */
diff --git a/lib/Kconfig b/lib/Kconfig
index b6009d7..f00ddab 100644
index 5e7541f..0d49ed0 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -241,6 +241,14 @@ config LZ4HC_COMPRESS
@@ -249,6 +249,14 @@ config LZ4HC_COMPRESS
config LZ4_DECOMPRESS
tristate
@@ -1331,7 +1335,7 @@ index b6009d7..f00ddab 100644
#
diff --git a/lib/Makefile b/lib/Makefile
index 1338226..4fcef16 100644
index d06b68a..d5c8a4f 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -116,6 +116,8 @@ obj-$(CONFIG_LZO_DECOMPRESS) += lzo/
@@ -10012,10 +10016,10 @@ index 0000000..2143da2
+#endif /* HUF_H_298734234 */
diff --git a/lib/zstd/huf_compress.c b/lib/zstd/huf_compress.c
new file mode 100644
index 0000000..0361f38
index 0000000..40055a7
--- /dev/null
+++ b/lib/zstd/huf_compress.c
@@ -0,0 +1,771 @@
@@ -0,0 +1,770 @@
+/*
+ * Huffman encoder, part of New Generation Entropy library
+ * Copyright (C) 2013-2016, Yann Collet.
@@ -10543,7 +10547,7 @@ index 0000000..0361f38
+
+size_t HUF_compressBound(size_t size) { return HUF_COMPRESSBOUND(size); }
+
+#define HUF_FLUSHBITS(s) (fast ? BIT_flushBitsFast(s) : BIT_flushBits(s))
+#define HUF_FLUSHBITS(s) BIT_flushBits(s)
+
+#define HUF_FLUSHBITS_1(stream) \
+ if (sizeof((stream)->bitContainer) * 8 < HUF_TABLELOG_MAX * 2 + 7) \
@@ -10560,7 +10564,6 @@ index 0000000..0361f38
+ BYTE *const oend = ostart + dstSize;
+ BYTE *op = ostart;
+ size_t n;
+ const unsigned fast = (dstSize >= HUF_BLOCKBOUND(srcSize));
+ BIT_CStream_t bitC;
+
+ /* init */
@@ -11993,10 +11996,10 @@ index 0000000..a282624
+}
diff --git a/lib/zstd/zstd_internal.h b/lib/zstd/zstd_internal.h
new file mode 100644
index 0000000..6748719
index 0000000..f0ba474
--- /dev/null
+++ b/lib/zstd/zstd_internal.h
@@ -0,0 +1,269 @@
@@ -0,0 +1,250 @@
+/**
+ * Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
+ * All rights reserved.
@@ -12125,35 +12128,16 @@ index 0000000..6748719
+/*-*******************************************
+* Shared functions to include for inlining
+*********************************************/
+static void ZSTD_copy8(void *dst, const void *src) { memcpy(dst, src, 8); }
+#define COPY8(d, s) \
+ { \
+ ZSTD_copy8(d, s); \
+ d += 8; \
+ s += 8; \
+ }
+
+static void ZSTD_copy8(void *dst, const void *src) {
+ memcpy(dst, src, 8);
+}
+/*! ZSTD_wildcopy() :
+* custom version of memcpy(), can copy up to 7 bytes too many (8 bytes if length==0) */
+#define WILDCOPY_OVERLENGTH 8
+ZSTD_STATIC void ZSTD_wildcopy(void *dst, const void *src, ptrdiff_t length)
+{
+ const BYTE *ip = (const BYTE *)src;
+ BYTE *op = (BYTE *)dst;
+ BYTE *const oend = op + length;
+ do
+ COPY8(op, ip)
+ while (op < oend);
+}
+
+ZSTD_STATIC void ZSTD_wildcopy_e(void *dst, const void *src, void *dstEnd) /* should be faster for decoding, but strangely, not verified on all platform */
+{
+ const BYTE *ip = (const BYTE *)src;
+ BYTE *op = (BYTE *)dst;
+ BYTE *const oend = (BYTE *)dstEnd;
+ do
+ COPY8(op, ip)
+ while (op < oend);
+ if (length > 0)
+ memcpy(dst, src, length);
+}
+
+/*-*******************************************