class Checksummer {
public:
+ enum CSumType {
+ CSUM_NONE = 1, //intentionally set to 1 to be aligned with OSDMnitor's pool_opts_t handling - it treats 0 as unset while we need to distinguish none and unset cases
+ CSUM_XXHASH32 = 2,
+ CSUM_XXHASH64 = 3,
+ CSUM_CRC32C = 4,
+ CSUM_CRC32C_16 = 5, // low 16 bits of crc32c
+ CSUM_CRC32C_8 = 6, // low 8 bits of crc32c
+ CSUM_MAX,
+ };
+ static const char *get_csum_type_string(unsigned t) {
+ switch (t) {
+ case CSUM_NONE: return "none";
+ case CSUM_XXHASH32: return "xxhash32";
+ case CSUM_XXHASH64: return "xxhash64";
+ case CSUM_CRC32C: return "crc32c";
+ case CSUM_CRC32C_16: return "crc32c_16";
+ case CSUM_CRC32C_8: return "crc32c_8";
+ default: return "???";
+ }
+ }
+ static int get_csum_string_type(const std::string &s) {
+ if (s == "none")
+ return CSUM_NONE;
+ if (s == "xxhash32")
+ return CSUM_XXHASH32;
+ if (s == "xxhash64")
+ return CSUM_XXHASH64;
+ if (s == "crc32c")
+ return CSUM_CRC32C;
+ if (s == "crc32c_16")
+ return CSUM_CRC32C_16;
+ if (s == "crc32c_8")
+ return CSUM_CRC32C_8;
+ return -EINVAL;
+ }
+ static size_t get_csum_value_size(int csum_type) {
+ switch (csum_type) {
+ case CSUM_NONE: return 0;
+ case CSUM_XXHASH32: return 4;
+ case CSUM_XXHASH64: return 8;
+ case CSUM_CRC32C: return 4;
+ case CSUM_CRC32C_16: return 2;
+ case CSUM_CRC32C_8: return 1;
+ default: return 0;
+ }
+ }
+
struct crc32c {
typedef __le32 value_t;
#ifndef COMPRESSION_PLUGIN_H
#define COMPRESSION_PLUGIN_H
+#include <iostream>
#include "common/Mutex.h"
#include "common/PluginRegistry.h"
#include "Compressor.h"
virtual ~CompressionPlugin() {}
virtual int factory(CompressorRef *cs,
- ostream *ss) = 0;
+ std::ostream *ss) = 0;
virtual const char* name() {return "CompressionPlugin";}
};
#include "Compressor.h"
#include "CompressionPlugin.h"
+#include "common/dout.h"
+const char * Compressor::get_comp_alg_name(int a) {
+ switch (a) {
+ case COMP_ALG_NONE: return "none";
+ case COMP_ALG_SNAPPY: return "snappy";
+ case COMP_ALG_ZLIB: return "zlib";
+ default: return "???";
+ }
+}
-CompressorRef Compressor::create(CephContext *cct, const string &type)
+boost::optional<Compressor::CompressionAlgorithm> Compressor::get_comp_alg_type(const std::string &s) {
+ if (s == "snappy")
+ return COMP_ALG_SNAPPY;
+ if (s == "zlib")
+ return COMP_ALG_ZLIB;
+ if (s == "")
+ return COMP_ALG_NONE;
+
+ return boost::optional<CompressionAlgorithm>();
+}
+
+const char *Compressor::get_comp_mode_name(int m) {
+ switch (m) {
+ case COMP_NONE: return "none";
+ case COMP_PASSIVE: return "passive";
+ case COMP_AGGRESSIVE: return "aggressive";
+ case COMP_FORCE: return "force";
+ default: return "???";
+ }
+}
+boost::optional<Compressor::CompressionMode> Compressor::get_comp_mode_type(const std::string &s) {
+ if (s == "force")
+ return COMP_FORCE;
+ if (s == "aggressive")
+ return COMP_AGGRESSIVE;
+ if (s == "passive")
+ return COMP_PASSIVE;
+ if (s == "none")
+ return COMP_NONE;
+ return boost::optional<CompressionMode>();
+}
+
+CompressorRef Compressor::create(CephContext *cct, const std::string &type)
{
CompressorRef cs_impl = NULL;
- stringstream ss;
+ std::stringstream ss;
PluginRegistry *reg = cct->get_plugin_registry();
CompressionPlugin *factory = dynamic_cast<CompressionPlugin*>(reg->get_with_load("compressor", type));
if (factory == NULL) {
lderr(cct) << __func__ << " factory return error " << err << dendl;
return cs_impl;
}
+
+CompressorRef Compressor::create(CephContext *cct, int alg)
+{
+ if (alg < 0 || alg >= COMP_ALG_LAST) {
+ lderr(cct) << __func__ << " invalid algorithm value:" << alg << dendl;
+ return CompressorRef();
+ }
+ std::string type_name = get_comp_alg_name(alg);
+ return create(cct, type_name);
+}
#ifndef CEPH_COMPRESSOR_H
#define CEPH_COMPRESSOR_H
-#include "include/int_types.h"
-#include "include/Context.h"
+#include <string>
+#include <boost/optional.hpp>
+#include "include/memory.h"
+#include "include/buffer.h"
class Compressor;
typedef shared_ptr<Compressor> CompressorRef;
class Compressor {
-protected:
- string type;
public:
- Compressor(string t) : type(t) {}
+ enum CompressionAlgorithm {
+ COMP_ALG_NONE = 0,
+ COMP_ALG_SNAPPY = 1,
+ COMP_ALG_ZLIB = 2,
+ COMP_ALG_LAST //the last value for range checks
+ };
+ // compression options
+ enum CompressionMode {
+ COMP_NONE, ///< compress never
+ COMP_PASSIVE, ///< compress if hinted COMPRESSIBLE
+ COMP_AGGRESSIVE, ///< compress unless hinted INCOMPRESSIBLE
+ COMP_FORCE ///< compress always
+ };
+
+ static const char * get_comp_alg_name(int a);
+ static boost::optional<CompressionAlgorithm> get_comp_alg_type(const std::string &s);
+
+ static const char *get_comp_mode_name(int m);
+ static boost::optional<CompressionMode> get_comp_mode_type(const std::string &s);
+
+ Compressor(CompressionAlgorithm a, const char* t) : alg(a), type(t) {
+ }
virtual ~Compressor() {}
- const string& get_type() const {
+ const std::string& get_type_name() const {
return type;
}
+ CompressionAlgorithm get_type() const {
+ return alg;
+ }
virtual int compress(const bufferlist &in, bufferlist &out) = 0;
virtual int decompress(const bufferlist &in, bufferlist &out) = 0;
// this is a bit weird but we need non-const iterator to be in
// alignment with decode methods
virtual int decompress(bufferlist::iterator &p, size_t compressed_len, bufferlist &out) = 0;
- static CompressorRef create(CephContext *cct, const string &type);
+ static CompressorRef create(CephContext *cct, const std::string &type);
+ static CompressorRef create(CephContext *cct, int alg);
+
+protected:
+ CompressionAlgorithm alg;
+ std::string type;
+
};
#endif
{}
virtual int factory(CompressorRef *cs,
- ostream *ss)
+ std::ostream *ss)
{
if (compressor == 0) {
SnappyCompressor *interface = new SnappyCompressor();
class SnappyCompressor : public Compressor {
public:
- SnappyCompressor() : Compressor("snappy") {}
+ SnappyCompressor() : Compressor(COMP_ALG_SNAPPY, "snappy") {}
int compress(const bufferlist &src, bufferlist &dst) override {
BufferlistSource source(const_cast<bufferlist&>(src).begin(), src.length());
{}
virtual int factory(CompressorRef *cs,
- ostream *ss)
+ std::ostream *ss)
{
bool isal;
if (cct->_conf->compressor_zlib_isal) {
class ZlibCompressor : public Compressor {
bool isal_enabled;
public:
- ZlibCompressor(bool isal) : Compressor("zlib"), isal_enabled(isal) {}
+ ZlibCompressor(bool isal) : Compressor(COMP_ALG_ZLIB, "zlib"), isal_enabled(isal) {}
int compress(const bufferlist &in, bufferlist &out) override;
int decompress(const bufferlist &in, bufferlist &out) override;
kv_stop(false),
logger(NULL),
debug_read_error_lock("BlueStore::debug_read_error_lock"),
- csum_type(bluestore_blob_t::CSUM_CRC32C),
+ csum_type(Checksummer::CSUM_CRC32C),
sync_wal_apply(cct->_conf->bluestore_sync_wal_apply)
{
_init_logger();
comp_min_blob_size = g_conf->bluestore_compression_min_blob_size;
comp_max_blob_size = g_conf->bluestore_compression_max_blob_size;
- if (g_conf->bluestore_compression == "force") {
- comp_mode = COMP_FORCE;
- } else if (g_conf->bluestore_compression == "aggressive") {
- comp_mode = COMP_AGGRESSIVE;
- } else if (g_conf->bluestore_compression == "passive") {
- comp_mode = COMP_PASSIVE;
- } else if (g_conf->bluestore_compression == "none") {
- comp_mode = COMP_NONE;
+ auto m = Compressor::get_comp_mode_type(g_conf->bluestore_compression);
+ if (m) {
+ comp_mode = *m;
} else {
derr << __func__ << " unrecognized value '"
<< g_conf->bluestore_compression
<< "' for bluestore_compression, reverting to 'none'"
<< dendl;
- comp_mode = COMP_NONE;
+ comp_mode = Compressor::COMP_NONE;
}
compressor = nullptr;
- if (comp_mode.load() != COMP_NONE) {
- const char *alg = 0;
- if (g_conf->bluestore_compression_algorithm == "snappy") {
- alg = "snappy";
- } else if (g_conf->bluestore_compression_algorithm == "zlib") {
- alg = "zlib";
- } else if (g_conf->bluestore_compression_algorithm.length()) {
- derr << __func__ << " unrecognized compression algorithm '"
- << g_conf->bluestore_compression_algorithm << "'"
- << ", reverting compression mode to 'none'"
- << dendl;
- comp_mode = COMP_NONE;
- } else {
- derr << __func__ << " compression algorithm not specified, "
- << "reverting compression mode to 'none'"
- << dendl;
- comp_mode = COMP_NONE;
- }
+ if (comp_mode.load() != Compressor::COMP_NONE) {
+
+ auto& alg_name = g_conf->bluestore_compression_algorithm;
- if (alg) {
- compressor = Compressor::create(cct, alg);
+ if (!alg_name.empty()) {
+ compressor = Compressor::create(cct, alg_name);
if (!compressor) {
- derr << __func__ << " unable to initialize " << alg << " compressor"
+ derr << __func__ << " unable to initialize " << alg_name << " compressor"
<< ", reverting compression mode to 'none'"
<< dendl;
- comp_mode = COMP_NONE;
+ comp_mode = Compressor::COMP_NONE;
}
}
}
- dout(10) << __func__ << " mode " << get_comp_mode_name(comp_mode)
- << " alg " << (compressor ? compressor->get_type() : "(none)")
+ dout(10) << __func__ << " mode " << Compressor::get_comp_mode_name(comp_mode)
+ << " alg " << (compressor ? compressor->get_type_name() : "(none)")
<< dendl;
}
void BlueStore::_set_csum()
{
- csum_type = bluestore_blob_t::CSUM_NONE;
- int t = bluestore_blob_t::get_csum_string_type(g_conf->bluestore_csum_type);
- if (t > bluestore_blob_t::CSUM_NONE)
+ csum_type = Checksummer::CSUM_NONE;
+ int t = Checksummer::get_csum_string_type(g_conf->bluestore_csum_type);
+ if (t > Checksummer::CSUM_NONE)
csum_type = t;
dout(10) << __func__ << " csum_type "
- << bluestore_blob_t::get_csum_type_string(csum_type)
+ << Checksummer::get_csum_type_string(csum_type)
<< dendl;
}
return 0;
});
assert(r == 0);
- derr << __func__ << " bad " << blob->get_csum_type_string(blob->csum_type)
+ derr << __func__ << " bad " << Checksummer::get_csum_type_string(blob->csum_type)
<< "/0x" << std::hex << blob->get_csum_chunk_size()
<< " checksum at blob offset 0x" << bad
<< ", got 0x" << bad_csum << ", expected 0x"
bufferlist::iterator i = source.begin();
bluestore_compression_header_t chdr;
::decode(chdr, i);
- string name = bluestore_blob_t::get_comp_alg_name(chdr.type);
+ int alg = int(chdr.type);
CompressorRef cp = compressor;
- if (!cp || cp->get_type() != name)
- cp = Compressor::create(cct, name);
+ if (!cp || (int)cp->get_type() != alg) {
+ cp = Compressor::create(cct, alg);
+ }
if (!cp.get()) {
// if compressor isn't available - error, because cannot return
// decompressed data?
- derr << __func__ << " can't load decompressor " << (int)chdr.type << dendl;
+ derr << __func__ << " can't load decompressor " << alg << dendl;
r = -EIO;
} else {
r = cp->decompress(i, chdr.length, *result);
assert(b_off == 0);
assert(wi.blob_length == l->length());
bluestore_compression_header_t chdr;
- chdr.type = bluestore_blob_t::get_comp_alg_type(c->get_type());
+ chdr.type = c->get_type();
// FIXME: memory alignment here is bad
bufferlist t;
unsigned alloc_hints = o->onode.alloc_hint_flags;
int comp = comp_mode.load();
wctx.compress =
- (comp == COMP_FORCE) ||
- (comp == COMP_AGGRESSIVE &&
+ (comp == Compressor::COMP_FORCE) ||
+ (comp == Compressor::COMP_AGGRESSIVE &&
(alloc_hints & CEPH_OSD_ALLOC_HINT_FLAG_INCOMPRESSIBLE) == 0) ||
- (comp == COMP_PASSIVE &&
+ (comp == Compressor::COMP_PASSIVE &&
(alloc_hints & CEPH_OSD_ALLOC_HINT_FLAG_COMPRESSIBLE));
if ((alloc_hints & CEPH_OSD_ALLOC_HINT_FLAG_SEQUENTIAL_READ) &&
bool sync_wal_apply; ///< see config option bluestore_sync_wal_apply
- // compression options
- enum CompressionMode {
- COMP_NONE, ///< compress never
- COMP_PASSIVE, ///< compress if hinted COMPRESSIBLE
- COMP_AGGRESSIVE, ///< compress unless hinted INCOMPRESSIBLE
- COMP_FORCE ///< compress always
- };
- const char *get_comp_mode_name(int m) {
- switch (m) {
- case COMP_NONE: return "none";
- case COMP_PASSIVE: return "passive";
- case COMP_AGGRESSIVE: return "aggressive";
- case COMP_FORCE: return "force";
- default: return "???";
- }
- }
- std::atomic<int> comp_mode = {COMP_NONE}; ///< compression mode
+ std::atomic<Compressor::CompressionMode> comp_mode = {Compressor::COMP_NONE}; ///< compression mode
CompressorRef compressor;
std::atomic<uint64_t> comp_min_blob_size = {0};
std::atomic<uint64_t> comp_max_blob_size = {0};
return s;
}
+size_t bluestore_blob_t::get_csum_value_size() const
+{
+ return Checksummer::get_csum_value_size(csum_type);
+}
+
void bluestore_blob_t::dump(Formatter *f) const
{
f->open_array_section("extents");
ls.push_back(new bluestore_blob_t);
ls.back()->extents.push_back(bluestore_pextent_t(111, 222));
ls.push_back(new bluestore_blob_t);
- ls.back()->init_csum(CSUM_XXHASH32, 16, 65536);
+ ls.back()->init_csum(Checksummer::CSUM_XXHASH32, 16, 65536);
ls.back()->csum_data = buffer::claim_malloc(4, strdup("abcd"));
ls.back()->add_unused(0, 3);
ls.back()->add_unused(8, 8);
out << " " << o.get_flags_string();
}
if (o.csum_type) {
- out << " " << o.get_csum_type_string(o.csum_type)
+ out << " " << Checksummer::get_csum_type_string(o.csum_type)
<< "/0x" << std::hex << (1ull << o.csum_chunk_order) << std::dec;
}
if (o.has_unused())
void bluestore_blob_t::calc_csum(uint64_t b_off, const bufferlist& bl)
{
switch (csum_type) {
- case CSUM_XXHASH32:
+ case Checksummer::CSUM_XXHASH32:
Checksummer::calculate<Checksummer::xxhash32>(
get_csum_chunk_size(), b_off, bl.length(), bl, &csum_data);
break;
- case CSUM_XXHASH64:
+ case Checksummer::CSUM_XXHASH64:
Checksummer::calculate<Checksummer::xxhash64>(
get_csum_chunk_size(), b_off, bl.length(), bl, &csum_data);
break;;
- case CSUM_CRC32C:
+ case Checksummer::CSUM_CRC32C:
Checksummer::calculate<Checksummer::crc32c>(
get_csum_chunk_size(), b_off, bl.length(), bl, &csum_data);
break;
- case CSUM_CRC32C_16:
+ case Checksummer::CSUM_CRC32C_16:
Checksummer::calculate<Checksummer::crc32c_16>(
get_csum_chunk_size(), b_off, bl.length(), bl, &csum_data);
break;
- case CSUM_CRC32C_8:
+ case Checksummer::CSUM_CRC32C_8:
Checksummer::calculate<Checksummer::crc32c_8>(
get_csum_chunk_size(), b_off, bl.length(), bl, &csum_data);
break;
*b_bad_off = -1;
switch (csum_type) {
- case CSUM_NONE:
+ case Checksummer::CSUM_NONE:
break;
- case CSUM_XXHASH32:
+ case Checksummer::CSUM_XXHASH32:
*b_bad_off = Checksummer::verify<Checksummer::xxhash32>(
get_csum_chunk_size(), b_off, bl.length(), bl, csum_data, bad_csum);
break;
- case CSUM_XXHASH64:
+ case Checksummer::CSUM_XXHASH64:
*b_bad_off = Checksummer::verify<Checksummer::xxhash64>(
get_csum_chunk_size(), b_off, bl.length(), bl, csum_data, bad_csum);
break;
- case CSUM_CRC32C:
+ case Checksummer::CSUM_CRC32C:
*b_bad_off = Checksummer::verify<Checksummer::crc32c>(
get_csum_chunk_size(), b_off, bl.length(), bl, csum_data, bad_csum);
break;
- case CSUM_CRC32C_16:
+ case Checksummer::CSUM_CRC32C_16:
*b_bad_off = Checksummer::verify<Checksummer::crc32c_16>(
get_csum_chunk_size(), b_off, bl.length(), bl, csum_data, bad_csum);
break;
- case CSUM_CRC32C_8:
+ case Checksummer::CSUM_CRC32C_8:
*b_bad_off = Checksummer::verify<Checksummer::crc32c_8>(
get_csum_chunk_size(), b_off, bl.length(), bl, csum_data, bad_csum);
break;
#include "include/utime.h"
#include "include/small_encoding.h"
#include "common/hobject.h"
+#include "compressor/Compressor.h"
+#include "common/Checksummer.h"
namespace ceph {
class Formatter;
};
static string get_flags_string(unsigned flags);
- enum CSumType {
- CSUM_NONE = 0,
- CSUM_XXHASH32 = 1,
- CSUM_XXHASH64 = 2,
- CSUM_CRC32C = 3,
- CSUM_CRC32C_16 = 4, // low 16 bits of crc32c
- CSUM_CRC32C_8 = 5, // low 8 bits of crc32c
- CSUM_MAX,
- };
- static const char *get_csum_type_string(unsigned t) {
- switch (t) {
- case CSUM_NONE: return "none";
- case CSUM_XXHASH32: return "xxhash32";
- case CSUM_XXHASH64: return "xxhash64";
- case CSUM_CRC32C: return "crc32c";
- case CSUM_CRC32C_16: return "crc32c_16";
- case CSUM_CRC32C_8: return "crc32c_8";
- default: return "???";
- }
- }
- static int get_csum_string_type(const std::string &s) {
- if (s == "none")
- return CSUM_NONE;
- if (s == "xxhash32")
- return CSUM_XXHASH32;
- if (s == "xxhash64")
- return CSUM_XXHASH64;
- if (s == "crc32c")
- return CSUM_CRC32C;
- if (s == "crc32c_16")
- return CSUM_CRC32C_16;
- if (s == "crc32c_8")
- return CSUM_CRC32C_8;
- return -EINVAL;
- }
-
- enum CompressionAlgorithm {
- COMP_ALG_NONE = 0,
- COMP_ALG_SNAPPY = 1,
- COMP_ALG_ZLIB = 2,
- };
-
- static const char * get_comp_alg_name(int a) {
- switch (a) {
- case COMP_ALG_NONE: return "none";
- case COMP_ALG_SNAPPY: return "snappy";
- case COMP_ALG_ZLIB: return "zlib";
- default: return "???";
- }
- }
-
- static int get_comp_alg_type(const std::string &s) {
- if (s == "none")
- return COMP_ALG_NONE;
- if (s == "snappy")
- return COMP_ALG_SNAPPY;
- if (s == "zlib")
- return COMP_ALG_ZLIB;
-
- assert(0 == "invalid compression algorithm");
- return COMP_ALG_NONE;
- }
-
vector<bluestore_pextent_t> extents;///< raw data position on device
uint64_t sbid = 0; ///< shared blob id (if shared)
uint32_t compressed_length_orig = 0;///< original length of compressed blob if any
uint32_t compressed_length = 0; ///< compressed length if any
uint32_t flags = 0; ///< FLAG_*
- uint8_t csum_type = CSUM_NONE; ///< CSUM_*
+ uint8_t csum_type = Checksummer::CSUM_NONE; ///< CSUM_*
uint8_t csum_chunk_order = 0; ///< csum block size is 1<<block_order bytes
bufferptr csum_data; ///< opaque vector of csum data
return get_ondisk_length();
}
}
+ size_t get_csum_value_size() const;
- size_t get_csum_value_size() const {
- switch (csum_type) {
- case CSUM_NONE: return 0;
- case CSUM_XXHASH32: return 4;
- case CSUM_XXHASH64: return 8;
- case CSUM_CRC32C: return 4;
- case CSUM_CRC32C_16: return 2;
- case CSUM_CRC32C_8: return 1;
- default: return 0;
- }
- }
size_t get_csum_count() const {
size_t vs = get_csum_value_size();
if (!vs)
WRITE_CLASS_DENC(bluestore_wal_transaction_t)
struct bluestore_compression_header_t {
- uint8_t type = bluestore_blob_t::COMP_ALG_NONE;
+ uint8_t type = Compressor::COMP_ALG_NONE;
uint32_t length = 0;
bluestore_compression_header_t() {}
<< std::dec
<< ")";
return out;
-}
+}
\ No newline at end of file
class CompressorExample : public Compressor {
public:
- CompressorExample() : Compressor("example") {}
+ CompressorExample() : Compressor(COMP_ALG_NONE, "example") {}
virtual ~CompressorExample() {}
virtual int compress(const bufferlist &in, bufferlist &out)
n.append("12345678");
for (unsigned csum_type = 1;
- csum_type < bluestore_blob_t::CSUM_MAX;
+ csum_type < Checksummer::CSUM_MAX;
++csum_type) {
- cout << "csum_type " << bluestore_blob_t::get_csum_type_string(csum_type)
+ cout << "csum_type " << Checksummer::get_csum_type_string(csum_type)
<< std::endl;
bluestore_blob_t b;
bl.append(bp);
int count = 256;
for (unsigned csum_type = 1;
- csum_type < bluestore_blob_t::CSUM_MAX;
+ csum_type < Checksummer::CSUM_MAX;
++csum_type) {
bluestore_blob_t b;
b.init_csum(csum_type, 12, bl.length());
ceph::mono_clock::time_point end = ceph::mono_clock::now();
auto dur = std::chrono::duration_cast<std::chrono::nanoseconds>(end - start);
double mbsec = (double)count * (double)bl.length() / 1000000.0 / (double)dur.count() * 1000000000.0;
- cout << "csum_type " << bluestore_blob_t::get_csum_type_string(csum_type)
+ cout << "csum_type " << Checksummer::get_csum_type_string(csum_type)
<< ", " << dur << " seconds, "
<< mbsec << " MB/sec" << std::endl;
}
bluestore_blob_t& b = B.dirty_blob();
vector<bluestore_pextent_t> r;
b.extents.push_back(bluestore_pextent_t(0, mas*4));
- b.init_csum(bluestore_blob_t::CSUM_CRC32C, 14, mas * 4);
+ b.init_csum(Checksummer::CSUM_CRC32C, 14, mas * 4);
B.get_ref(0, mas*4);
ASSERT_TRUE(b.is_allocated(0, mas*4));
B.put_ref(0, mas*3, mrs, &r);
a.extents.emplace_back(bluestore_pextent_t(0x20000, 0x2000));
ASSERT_TRUE(a.can_split_at(0x1000));
ASSERT_TRUE(a.can_split_at(0x1800));
- a.init_csum(bluestore_blob_t::CSUM_CRC32C, 12, 0x4000);
+ a.init_csum(Checksummer::CSUM_CRC32C, 12, 0x4000);
ASSERT_TRUE(a.can_split_at(0x1000));
ASSERT_TRUE(a.can_split_at(0x2000));
ASSERT_TRUE(a.can_split_at(0x3000));
a.extents.emplace_back(
bluestore_pextent_t(bluestore_pextent_t::INVALID_OFFSET, 0x2000));
- a.init_csum(bluestore_blob_t::CSUM_CRC32C_8, 12, 0x6000);
+ a.init_csum(Checksummer::CSUM_CRC32C_8, 12, 0x6000);
ASSERT_EQ(6u, a.csum_data.length());
ASSERT_TRUE(a.can_prune_tail());
a.prune_tail();
R.shared_blob = new BlueStore::SharedBlob(-1, string(), cache);
R.shared_blob->get(); // hack to avoid dtor from running
L.dirty_blob().extents.emplace_back(bluestore_pextent_t(0x2000, 0x2000));
- L.dirty_blob().init_csum(bluestore_blob_t::CSUM_CRC32C, 12, 0x2000);
+ L.dirty_blob().init_csum(Checksummer::CSUM_CRC32C, 12, 0x2000);
L.split(0x1000, &R);
ASSERT_EQ(0x1000u, L.get_blob().get_logical_length());
ASSERT_EQ(4u, L.get_blob().csum_data.length());
R.shared_blob->get(); // hack to avoid dtor from running
L.dirty_blob().extents.emplace_back(bluestore_pextent_t(0x2000, 0x1000));
L.dirty_blob().extents.emplace_back(bluestore_pextent_t(0x12000, 0x1000));
- L.dirty_blob().init_csum(bluestore_blob_t::CSUM_CRC32C, 12, 0x2000);
+ L.dirty_blob().init_csum(Checksummer::CSUM_CRC32C, 12, 0x2000);
L.split(0x1000, &R);
ASSERT_EQ(0x1000u, L.get_blob().get_logical_length());
ASSERT_EQ(4u, L.get_blob().csum_data.length());