compressor: conditionalize on HAVE_LZ4

do not enable lz4 compressor plugin unless HAVE_LZ4 is ON. so, for
example, when the compressor type is "random", the compressor factory
won't complain with:

load failed dlopen(): "/usr/lib64/ceph/compressor/libceph_lz4.so: cannot
open shared object file: No such file or directory"

anymore.

Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2017-08-17 15:12:22 +08:00
parent 588e5d03b6
commit b5ea349c0d
2 changed files with 6 additions and 0 deletions

View File

@ -27,7 +27,9 @@ const char * Compressor::get_comp_alg_name(int a) {
case COMP_ALG_SNAPPY: return "snappy";
case COMP_ALG_ZLIB: return "zlib";
case COMP_ALG_ZSTD: return "zstd";
#ifdef HAVE_LZ4
case COMP_ALG_LZ4: return "lz4";
#endif
default: return "???";
}
}
@ -39,8 +41,10 @@ boost::optional<Compressor::CompressionAlgorithm> Compressor::get_comp_alg_type(
return COMP_ALG_ZLIB;
if (s == "zstd")
return COMP_ALG_ZSTD;
#ifdef HAVE_LZ4
if (s == "lz4")
return COMP_ALG_LZ4;
#endif
if (s == "" || s == "none")
return COMP_ALG_NONE;

View File

@ -34,7 +34,9 @@ public:
COMP_ALG_SNAPPY = 1,
COMP_ALG_ZLIB = 2,
COMP_ALG_ZSTD = 3,
#ifdef HAVE_LZ4
COMP_ALG_LZ4 = 4,
#endif
COMP_ALG_LAST //the last value for range checks
};
// compression options