Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os/bluestore: fix up compression tests and debug output #11350

Merged
merged 3 commits into from
Oct 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/os/bluestore/BlueStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7549,10 +7549,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 @@ -7572,14 +7572,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
Original file line number Diff line number Diff line change
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