We dynamically enable this if the necessary processor features are present.
Allow this probing to be disabled explicitly.
Signed-off-by: Sage Weil <sage@redhat.com>
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, true)
+
OPTION(async_compressor_enabled, OPT_BOOL, false)
OPTION(async_compressor_type, OPT_STR, "snappy")
OPTION(async_compressor_threads, OPT_INT, 2)
class CompressionPluginZlib : public CompressionPlugin {
public:
+ bool has_isal = false;
explicit CompressionPluginZlib(CephContext *cct) : CompressionPlugin(cct)
{}
virtual int factory(CompressorRef *cs,
ostream *ss)
{
- if (compressor == 0) {
+ bool isal;
+ if (cct->_conf->compressor_zlib_isal) {
ceph_arch_probe();
- bool isal = (ceph_arch_intel_pclmul && ceph_arch_intel_sse41);
- ZlibCompressor *interface = new ZlibCompressor(isal);
- compressor = CompressorRef(interface);
+ isal = (ceph_arch_intel_pclmul && ceph_arch_intel_sse41);
+ } else {
+ isal = false;
+ }
+ if (compressor == 0 || has_isal != isal) {
+ compressor = CompressorRef(new ZlibCompressor(isal));
+ has_isal = isal;
}
*cs = compressor;
return 0;
class CompressionTest : public ::testing::Test,
public ::testing::WithParamInterface<const char*> {
public:
+ std::string plugin;
CompressorRef compressor;
+ CompressionTest() {
+ plugin = GetParam();
+ size_t pos = plugin.find('/');
+ if (pos != std::string::npos) {
+ string isal = plugin.substr(pos + 1);
+ plugin = plugin.substr(0, pos);
+ if (isal == "isal") {
+ g_conf->set_val("compressor_zlib_isal", "true");
+ g_ceph_context->_conf->apply_changes(NULL);
+ } else if (isal == "noisal") {
+ g_conf->set_val("compressor_zlib_isal", "false");
+ g_ceph_context->_conf->apply_changes(NULL);
+ } else {
+ assert(0 == "bad option");
+ }
+ }
+ cout << "[plugin " << plugin << " (" << GetParam() << ")]" << std::endl;
+ }
+
void SetUp() {
- compressor = Compressor::create(g_ceph_context, GetParam());
+ compressor = Compressor::create(g_ceph_context, plugin);
ASSERT_TRUE(compressor);
}
void TearDown() {
Compression,
CompressionTest,
::testing::Values(
- "zlib",
+ "zlib/isal",
+ "zlib/noisal",
"snappy"));
int main(int argc, char **argv) {