void BlueStore::Onode::flush()
{
- if (flushing_count) {
+ if (flushing_count.load()) {
+ ldout(c->store->cct, 20) << __func__ << " cnt:" << flushing_count << dendl;
std::unique_lock<std::mutex> l(flush_lock);
- ldout(c->store->cct, 20) << flush_txns << dendl;
- while (!flush_txns.empty())
+ while (flushing_count.load()) {
flush_cond.wait(l);
+ }
}
- ldout(c->store->cct, 20) << "done" << dendl;
+ ldout(c->store->cct, 20) << __func__ << " done" << dendl;
}
// =======================================================
dout(10) << __func__ << " " << c << " " << c->cid << dendl;
if (c->onode_map.map_any([&](OnodeRef o) {
assert(!o->exists);
- if (!o->flush_txns.empty()) {
+ if (o->flushing_count.load()) {
dout(10) << __func__ << " " << c << " " << c->cid << " " << o->oid
- << " flush_txns " << o->flush_txns << dendl;
+ << " flush_txns " << o->flushing_count << dendl;
return false;
}
return true;
<< extent_part << " bytes inline extents)"
<< dendl;
t->set(PREFIX_OBJ, o->key.c_str(), o->key.size(), bl);
-
- std::lock_guard<std::mutex> l(o->flush_lock);
- o->flush_txns.insert(txc);
o->flushing_count++;
}
auto p = txc->modified_objects.begin();
while (p != txc->modified_objects.end()) {
if (txc->onodes.count(*p) == 0) {
- std::lock_guard<std::mutex> l((*p)->flush_lock);
- (*p)->flush_txns.insert(txc);
(*p)->flushing_count++;
++p;
} else {
{
for (auto ls : { &txc->onodes, &txc->modified_objects }) {
for (auto& o : *ls) {
- std::lock_guard<std::mutex> l(o->flush_lock);
- dout(20) << __func__ << " onode " << o << " had " << o->flush_txns
+ dout(20) << __func__ << " onode " << o << " had " << o->flushing_count
<< dendl;
- assert(o->flush_txns.count(txc));
- o->flush_txns.erase(txc);
- o->flushing_count--;
- if (o->flush_txns.empty()) {
+ if (--o->flushing_count == 0) {
+ std::lock_guard<std::mutex> l(o->flush_lock);
o->flush_cond.notify_all();
}
}