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: misc cleanups #10201

Merged
merged 5 commits into from Jul 8, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
72 changes: 39 additions & 33 deletions src/os/bluestore/BlueStore.cc
Expand Up @@ -1429,42 +1429,48 @@ void BlueStore::_set_compression()
comp_min_blob_size = g_conf->bluestore_compression_min_blob_size;
comp_max_blob_size = g_conf->bluestore_compression_max_blob_size;

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 << "'" << dendl;
}
if (alg) {
compressor = Compressor::create(cct, alg);
if (!compressor) {
derr << __func__ << " unable to initialize " << alg << " compressor"
<< dendl;
}
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;
} else {
compressor = nullptr;
}
CompressionMode m = COMP_NONE;
if (compressor) {
if (g_conf->bluestore_compression == "force") {
m = COMP_FORCE;
} else if (g_conf->bluestore_compression == "aggressive") {
m = COMP_AGGRESSIVE;
} else if (g_conf->bluestore_compression == "passive") {
m = COMP_PASSIVE;
} else if (g_conf->bluestore_compression == "none") {
m = COMP_NONE;
} else {
derr << __func__ << " unrecognized value '"
<< g_conf->bluestore_compression
<< "' for bluestore_compression, reverting to 'none'" << dendl;
m = COMP_NONE;
derr << __func__ << " unrecognized value '"
<< g_conf->bluestore_compression
<< "' for bluestore_compression, reverting to 'none'"
<< dendl;
comp_mode = COMP_NONE;
}

compressor = nullptr;
if (comp_mode != 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;
}

if (alg) {
compressor = Compressor::create(cct, alg);
if (!compressor) {
derr << __func__ << " unable to initialize " << alg << " compressor"
<< ", reverting compression mode to 'none'"
<< dendl;
comp_mode = COMP_NONE;
}
}
}
comp_mode = m;

dout(10) << __func__ << " mode " << get_comp_mode_name(comp_mode)
<< " alg " << (compressor ? compressor->get_type() : "(none)")
<< dendl;
Expand Down
2 changes: 1 addition & 1 deletion src/os/bluestore/bluestore_types.cc
Expand Up @@ -941,7 +941,7 @@ void bluestore_onode_t::punch_hole(
p->second.blob,
p->second.offset + p->second.length - keep,
keep);
extent_map.erase(p++);
extent_map.erase(p);
break;
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/os/bluestore/bluestore_types.h
Expand Up @@ -283,6 +283,7 @@ struct bluestore_blob_t {
}
b_len += b_off;
while (b_len) {
assert(p != extents.end());
if (!p->is_valid()) {
return false;
}
Expand Down Expand Up @@ -361,6 +362,7 @@ struct bluestore_blob_t {
assert(p != extents.end());
}
while (x_len > 0) {
assert(p != extents.end());
uint64_t l = MIN(p->length - x_off, x_len);
f(p->offset + x_off, l);
x_off = 0;
Expand All @@ -381,6 +383,7 @@ struct bluestore_blob_t {
bufferlist::iterator it = bl.begin();
uint64_t x_len = bl.length();
while (x_len > 0) {
assert(p != extents.end());
uint64_t l = MIN(p->length - x_off, x_len);
bufferlist t;
it.copy(l, t);
Expand Down Expand Up @@ -609,9 +612,7 @@ struct bluestore_wal_transaction_t {
list<bluestore_wal_op_t> ops;
interval_set<uint64_t> released; ///< allocations to release after wal

int64_t _bytes; ///< cached byte count

bluestore_wal_transaction_t() : seq(0), _bytes(-1) {}
bluestore_wal_transaction_t() : seq(0) {}

void encode(bufferlist& bl) const;
void decode(bufferlist::iterator& p);
Expand Down