Merge pull request #18203 from majianpeng/bluestore-wake-kvfinathread

os/bluestore/BlueStore: ASAP wake up _kv_finalize_thread.

Reviewed-by: xie xingguo <xie.xingguo@zte.com.cn>
Reviewed-by: Varada Kari <varada.kari@sandisk.com>
This commit is contained in:
Xie Xingguo 2017-10-11 11:35:40 +08:00 committed by GitHub
commit f9e8ba7f4d

View File

@ -8564,6 +8564,29 @@ void BlueStore::_kv_sync_thread()
int r = cct->_conf->bluestore_debug_omit_kv_commit ? 0 : db->submit_transaction_sync(synct);
assert(r == 0);
{
std::unique_lock<std::mutex> m(kv_finalize_lock);
if (kv_committing_to_finalize.empty()) {
kv_committing_to_finalize.swap(kv_committing);
} else {
kv_committing_to_finalize.insert(
kv_committing_to_finalize.end(),
kv_committing.begin(),
kv_committing.end());
kv_committing.clear();
}
if (deferred_stable_to_finalize.empty()) {
deferred_stable_to_finalize.swap(deferred_stable);
} else {
deferred_stable_to_finalize.insert(
deferred_stable_to_finalize.end(),
deferred_stable.begin(),
deferred_stable.end());
deferred_stable.clear();
}
kv_finalize_cond.notify_one();
}
if (new_nid_max) {
nid_max = new_nid_max;
dout(10) << __func__ << " nid_max now " << nid_max << dendl;
@ -8598,29 +8621,6 @@ void BlueStore::_kv_sync_thread()
bluefs_extents_reclaiming.clear();
}
{
std::unique_lock<std::mutex> m(kv_finalize_lock);
if (kv_committing_to_finalize.empty()) {
kv_committing_to_finalize.swap(kv_committing);
} else {
kv_committing_to_finalize.insert(
kv_committing_to_finalize.end(),
kv_committing.begin(),
kv_committing.end());
kv_committing.clear();
}
if (deferred_stable_to_finalize.empty()) {
deferred_stable_to_finalize.swap(deferred_stable);
} else {
deferred_stable_to_finalize.insert(
deferred_stable_to_finalize.end(),
deferred_stable.begin(),
deferred_stable.end());
deferred_stable.clear();
}
kv_finalize_cond.notify_one();
}
l.lock();
// previously deferred "done" are now "stable" by virtue of this
// commit cycle.