archrelease: copy trunk to community-any
[ArchLinux/community.git] / ceph / trunk / use-system-zstd-and-fix-zstd-1.4.0-compatbility.patch
blobec5ea5389053a9f4bbe1d9b46ac988ce636955d7
1 --- a/src/compressor/zstd/ZstdCompressor.h 2019-04-25 20:15:48.000000000 +0200
2 +++ b/src/compressor/zstd/ZstdCompressor.h 2019-07-17 19:11:33.177014923 +0200
3 @@ -16,7 +16,7 @@
4 #define CEPH_ZSTDCOMPRESSOR_H
6 #define ZSTD_STATIC_LINKING_ONLY
7 -#include "zstd/lib/zstd.h"
8 +#include <zstd.h>
10 #include "include/buffer.h"
11 #include "include/encoding.h"
12 @@ -30,7 +30,13 @@ class ZstdCompressor : public Compressor
14 int compress(const bufferlist &src, bufferlist &dst) override {
15 ZSTD_CStream *s = ZSTD_createCStream();
16 - ZSTD_initCStream_srcSize(s, COMPRESSION_LEVEL, src.length());
18 + // ZSTD_initCStream_srcSize(s, COMPRESSION_LEVEL, src.length());
19 + ZSTD_CCtx_reset(s, ZSTD_reset_session_only);
20 + ZSTD_CCtx_refCDict(s, NULL); // clear the dictionary (if any)
21 + ZSTD_CCtx_setParameter(s, ZSTD_c_compressionLevel, COMPRESSION_LEVEL);
22 + ZSTD_CCtx_setPledgedSrcSize(s, src.length());
24 auto p = src.begin();
25 size_t left = src.length();
27 @@ -48,7 +54,7 @@ class ZstdCompressor : public Compressor
28 inbuf.size = p.get_ptr_and_advance(left, (const char**)&inbuf.src);
29 left -= inbuf.size;
30 ZSTD_EndDirective const zed = (left==0) ? ZSTD_e_end : ZSTD_e_continue;
31 - size_t r = ZSTD_compress_generic(s, &outbuf, &inbuf, zed);
32 + size_t r = ZSTD_compressStream2(s, &outbuf, &inbuf, zed);
33 if (ZSTD_isError(r)) {
34 return -EINVAL;