if (!onfinish) {
onfinish = new C_Client_PutInode(this, in);
}
- bool safe = objectcacher->flush_set(&in->oset, onfinish);
- if (safe) {
- onfinish->complete(0);
- }
- return safe;
+ return objectcacher->flush_set(&in->oset, onfinish);
}
void Client::_flush_range(Inode *in, int64_t offset, uint64_t size)
assert(lock.is_locked());
if (oset->objects.empty()) {
ldout(cct, 10) << "flush_set on " << oset << " dne" << dendl;
- delete onfinish;
+ onfinish->complete(0);
return true;
}
ldout(cct, 10) << "flush_set " << oset << dendl;
// we'll need to wait for all objects to flush!
- C_GatherBuilder gather(cct, onfinish);
+ C_GatherBuilder gather(cct);
bool safe = true;
for (xlist<Object*>::iterator i = oset->objects.begin();
ob->waitfor_commit[ob->last_write_tid].push_back(gather.new_sub());
}
}
+ if (gather.has_subs())
+ gather.set_finisher(onfinish);
if (onfinish != NULL)
gather.activate();
if (safe) {
ldout(cct, 10) << "flush_set " << oset << " has no dirty|tx bhs" << dendl;
+ onfinish->complete(0);
return true;
}
return false;
assert(lock.is_locked());
if (oset->objects.empty()) {
ldout(cct, 10) << "flush_set on " << oset << " dne" << dendl;
- delete onfinish;
+ onfinish->complete(0);
return true;
}
ldout(cct, 10) << "flush_set " << oset << " on " << exv.size() << " ObjectExtents" << dendl;
// we'll need to wait for all objects to flush!
- C_GatherBuilder gather(cct, onfinish);
+ C_GatherBuilder gather(cct);
bool safe = true;
for (vector<ObjectExtent>::iterator p = exv.begin();
ob->waitfor_commit[ob->last_write_tid].push_back(gather.new_sub());
}
}
+ if (gather.has_subs())
+ gather.set_finisher(onfinish);
if (onfinish != NULL)
gather.activate();
if (safe) {
ldout(cct, 10) << "flush_set " << oset << " has no dirty|tx bhs" << dendl;
+ onfinish->complete(0);
return true;
}
return false;
bool already_flushed = obc.flush_set(&object_set, onfinish);
std::cout << "already flushed = " << already_flushed << std::endl;
lock.Unlock();
- if (!already_flushed) {
- mylock.Lock();
- while (!done) {
- cond.Wait(mylock);
- }
- mylock.Unlock();
+ mylock.Lock();
+ while (!done) {
+ cond.Wait(mylock);
}
+ mylock.Unlock();
lock.Lock();
bool unclean = obc.release_set(&object_set);