Merge pull request #16315 from majianpeng/bluestore-misc-fix

os/bluestore: misc fix and cleanups

Reviewed-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Sage Weil 2017-07-16 21:11:11 -05:00 committed by GitHub
commit 1a0d645b1c

View File

@ -8425,16 +8425,16 @@ void BlueStore::_kv_sync_thread()
dout(10) << __func__ << " blobid_max now " << blobid_max << dendl;
}
utime_t finish = ceph_clock_now();
utime_t dur_flush = after_flush - start;
utime_t dur_kv = finish - after_flush;
utime_t dur = finish - start;
dout(20) << __func__ << " committed " << kv_committing.size()
<< " cleaned " << deferred_stable.size()
<< " in " << dur
<< " (" << dur_flush << " flush + " << dur_kv << " kv commit)"
<< dendl;
if (logger) {
{
utime_t finish = ceph_clock_now();
utime_t dur_flush = after_flush - start;
utime_t dur_kv = finish - after_flush;
utime_t dur = finish - start;
dout(20) << __func__ << " committed " << kv_committing.size()
<< " cleaned " << deferred_stable.size()
<< " in " << dur
<< " (" << dur_flush << " flush + " << dur_kv << " kv commit)"
<< dendl;
logger->tinc(l_bluestore_kv_flush_lat, dur_flush);
logger->tinc(l_bluestore_kv_commit_lat, dur_kv);
logger->tinc(l_bluestore_kv_lat, dur);
@ -9289,12 +9289,12 @@ void BlueStore::_pad_zeros(
if (front_pad) {
size_t front_copy = MIN(chunk_size - front_pad, length);
bufferptr z = buffer::create_page_aligned(chunk_size);
memset(z.c_str(), 0, front_pad);
z.zero(0, front_pad, false);
pad_count += front_pad;
memcpy(z.c_str() + front_pad, bl->get_contiguous(0, front_copy), front_copy);
bl->copy(0, front_copy, z.c_str() + front_pad);
if (front_copy + front_pad < chunk_size) {
back_pad = chunk_size - (length + front_pad);
memset(z.c_str() + front_pad + length, 0, back_pad);
z.zero(front_pad + length, back_pad, false);
pad_count += back_pad;
}
bufferlist old, t;
@ -9303,7 +9303,7 @@ void BlueStore::_pad_zeros(
bl->append(z);
bl->claim_append(t);
*offset -= front_pad;
length += front_pad + back_pad;
length += pad_count;
}
// back
@ -9314,9 +9314,8 @@ void BlueStore::_pad_zeros(
back_pad = chunk_size - back_copy;
assert(back_copy <= length);
bufferptr tail(chunk_size);
memcpy(tail.c_str(), bl->get_contiguous(length - back_copy, back_copy),
back_copy);
memset(tail.c_str() + back_copy, 0, back_pad);
bl->copy(length - back_copy, back_copy, tail.c_str());
tail.zero(back_copy, back_pad, false);
bufferlist old;
old.swap(*bl);
bl->substr_of(old, 0, length - back_copy);