From: Kefu Chai Date: Mon, 27 Apr 2020 03:28:05 +0000 (+0800) Subject: Merge pull request #33790 from bstillwell/add_conf_option_zstd_compression_level X-Git-Tag: v16.1.0~2500 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6ad027c63ec1fca1dae79bb6e51346adb15e3e23;p=ceph.git Merge pull request #33790 from bstillwell/add_conf_option_zstd_compression_level compressor: Add a config option to specify Zstd compression level Reviewed-by: Kefu Chai --- 6ad027c63ec1fca1dae79bb6e51346adb15e3e23 diff --cc src/compressor/zstd/ZstdCompressor.h index efbb6a5ea2fd,27812f0a834d..b59f3314fb47 --- a/src/compressor/zstd/ZstdCompressor.h +++ b/src/compressor/zstd/ZstdCompressor.h @@@ -22,15 -22,13 +22,13 @@@ #include "include/encoding.h" #include "compressor/Compressor.h" - #define COMPRESSION_LEVEL 5 - class ZstdCompressor : public Compressor { public: - ZstdCompressor() : Compressor(COMP_ALG_ZSTD, "zstd") {} + ZstdCompressor(CephContext *cct) : Compressor(COMP_ALG_ZSTD, "zstd"), cct(cct) {} - int compress(const bufferlist &src, bufferlist &dst) override { + int compress(const ceph::buffer::list &src, ceph::buffer::list &dst) override { ZSTD_CStream *s = ZSTD_createCStream(); - ZSTD_initCStream_srcSize(s, COMPRESSION_LEVEL, src.length()); + ZSTD_initCStream_srcSize(s, cct->_conf->compressor_zstd_level, src.length()); auto p = src.begin(); size_t left = src.length();