]>
git.proxmox.com Git - ceph.git/blob - ceph/src/compressor/zlib/CompressionPluginZlib.h
2 * Ceph - scalable distributed file system
4 * Copyright (C) 2015 Mirantis, Inc.
6 * Author: Alyona Kiseleva <akiselyova@mirantis.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
15 #ifndef CEPH_COMPRESSION_PLUGIN_ZLIB_H
16 #define CEPH_COMPRESSION_PLUGIN_ZLIB_H
18 // -----------------------------------------------------------------------------
19 #include "arch/probe.h"
20 #include "arch/intel.h"
22 #include "common/config.h"
23 #include "compressor/CompressionPlugin.h"
24 #include "ZlibCompressor.h"
26 // -----------------------------------------------------------------------------
28 class CompressionPluginZlib
: public CompressionPlugin
{
30 bool has_isal
= false;
32 explicit CompressionPluginZlib(CephContext
*cct
) : CompressionPlugin(cct
)
35 int factory(CompressorRef
*cs
,
36 std::ostream
*ss
) override
39 #if defined(__i386__) || defined(__x86_64__)
40 // other arches or lack of support result in isal = false
41 if (cct
->_conf
->compressor_zlib_isal
) {
43 isal
= (ceph_arch_intel_pclmul
&& ceph_arch_intel_sse41
);
46 if (compressor
== 0 || has_isal
!= isal
) {
47 compressor
= std::make_shared
<ZlibCompressor
>(cct
, isal
);