Skip to content

Commit

Permalink
Merge pull request #11350 from liewegas/wip-bluestore-compression
Browse files Browse the repository at this point in the history
os/bluestore: fix up compression tests and debug output

Reviewed-by: Igor Fedotov <ifedotov@mirantis.com>
  • Loading branch information
liewegas committed Oct 6, 2016
2 parents b34841d + 1c9a795 commit a3420f5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
17 changes: 10 additions & 7 deletions src/os/bluestore/BlueStore.cc
Expand Up @@ -7526,10 +7526,10 @@ int BlueStore::_do_alloc_write(
compressed_bl.claim_append(t);
uint64_t rawlen = compressed_bl.length();
uint64_t newlen = P2ROUNDUP(rawlen, min_alloc_size);
uint64_t dstlen = final_length *
uint64_t want_len_raw = final_length *
g_conf->bluestore_compression_required_ratio;
dstlen = P2ROUNDUP(dstlen, min_alloc_size);
if (newlen <= dstlen && newlen < final_length) {
uint64_t want_len = P2ROUNDUP(want_len_raw, min_alloc_size);
if (newlen <= want_len && newlen < final_length) {
// Cool. We compressed at least as much as we were hoping to.
// pad out to min_alloc_size
compressed_bl.append_zero(newlen - rawlen);
Expand All @@ -7549,14 +7549,17 @@ int BlueStore::_do_alloc_write(
compressed = true;
logger->inc(l_bluestore_compress_success_count);
} else {
dout(20) << __func__ << std::hex << " compressed 0x" << l->length()
<< " -> 0x" << rawlen << " with " << (int)chdr.type
<< ", which is more than required 0x" << dstlen
dout(20) << __func__ << std::hex << " 0x" << l->length()
<< " compressed to 0x" << rawlen << " -> 0x" << newlen
<< " with " << (int)chdr.type
<< ", which is more than required 0x" << want_len_raw
<< " -> 0x" << want_len
<< ", leaving uncompressed"
<< std::dec << dendl;
logger->inc(l_bluestore_compress_rejected_count);
}
logger->tinc(l_bluestore_compress_lat, ceph_clock_now(g_ceph_context) - start);
logger->tinc(l_bluestore_compress_lat,
ceph_clock_now(g_ceph_context) - start);
}
if (!compressed) {
b->dirty_blob().set_flag(bluestore_blob_t::FLAG_MUTABLE);
Expand Down
10 changes: 6 additions & 4 deletions src/test/objectstore/store_test.cc
Expand Up @@ -3295,7 +3295,8 @@ class SyntheticWorkloadState {
}
bufferptr bp(size);
for (unsigned int i = 0; i < size - 1; i++) {
bp[i] = alphanum[rand() % (sizeof(alphanum) - 1)];
// severely limit entropy so we can compress...
bp[i] = alphanum[rand() % 10]; //(sizeof(alphanum) - 1)];
}
bp[size - 1] = '\0';

Expand Down Expand Up @@ -4259,11 +4260,12 @@ TEST_P(StoreTest, SyntheticMatrixCsumVsCompression) {
return;

const char *m[][10] = {
{ "max_write", "65536", 0 },
{ "max_write", "131072", 0 },
{ "max_size", "262144", 0 },
{ "alignment", "512", 0 },
{ "bluestore_min_alloc_size", "32768", "4096", 0 },
{ "bluestore_compression", "force", "none", 0},
{ "bluestore_min_alloc_size", "4096", "16384", 0 },
{ "bluestore_compression", "force", 0},
{ "bluestore_compression_algorithm", "snappy", "zlib", 0 },
{ "bluestore_csum_type", "crc32c", 0 },
{ "bluestore_default_buffered_read", "true", "false", 0 },
{ 0 },
Expand Down

0 comments on commit a3420f5

Please sign in to comment.