]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/compressor/ZLibCompressor: add a config option to specify compression level 11445/head
authorIgor Fedotov <ifedotov@mirantis.com>
Fri, 14 Oct 2016 13:44:47 +0000 (13:44 +0000)
committerIgor Fedotov <ifedotov@mirantis.com>
Fri, 14 Oct 2016 13:44:47 +0000 (13:44 +0000)
Signed-off-by: Igor Fedotov <ifedotov@mirantis.com>
src/common/config_opts.h
src/compressor/zlib/ZlibCompressor.cc

index 992895e286a79e6c141291fa652fcb8dce679418..74fac89b2352e08b628487066b39f6a8d4c16a38 100644 (file)
@@ -98,6 +98,7 @@ OPTION(xio_transport_type, OPT_STR, "rdma") // xio transport type: {rdma or tcp}
 OPTION(xio_max_send_inline, OPT_INT, 512) // xio maximum threshold to send inline
 
 OPTION(compressor_zlib_isal, OPT_BOOL, false)
+OPTION(compressor_zlib_level, OPT_INT, 5) //regular zlib compression level, not applicable to isa-l optimized version
 
 OPTION(async_compressor_enabled, OPT_BOOL, false)
 OPTION(async_compressor_type, OPT_STR, "snappy")
index cb8c0b06d31028269e49ba0d3d5db7e1b9172eb9..45338588be3763f41ba4ac61826e854998cb73b9 100644 (file)
@@ -41,9 +41,6 @@ _prefix(std::ostream* _dout)
 // default window size for Zlib 1.2.8, negated for raw deflate
 #define ZLIB_DEFAULT_WIN_SIZE -15
 
-// compression level we use. probably should be configurable...
-#define ZLIB_COMPRESSION_LEVEL 5
-
 // desired memory usage level. increasing to 9 doesn't speed things up
 // significantly (helps only on >=16K blocks) and sometimes degrades
 // compression ratio.
@@ -61,7 +58,7 @@ int ZlibCompressor::zlib_compress(const bufferlist &in, bufferlist &out)
   strm.zalloc = Z_NULL;
   strm.zfree = Z_NULL;
   strm.opaque = Z_NULL;
-  ret = deflateInit2(&strm, ZLIB_COMPRESSION_LEVEL, Z_DEFLATED, ZLIB_DEFAULT_WIN_SIZE, ZLIB_MEMORY_LEVEL, Z_DEFAULT_STRATEGY);
+  ret = deflateInit2(&strm, g_conf->compressor_zlib_level, Z_DEFLATED, ZLIB_DEFAULT_WIN_SIZE, ZLIB_MEMORY_LEVEL, Z_DEFAULT_STRATEGY);
   if (ret != Z_OK) {
     dout(1) << "Compression init error: init return "
          << ret << " instead of Z_OK" << dendl;