CopyOpRef cop(new CopyOp(cb, obc, src, oloc, version, flags, temp_dest_oid));
copy_ops[dest] = cop;
- ++obc->copyfrom_readside;
+ obc->start_block();
_copy_some(obc, cop);
}
cop->cb->complete(results);
copy_ops.erase(cobc->obs.oi.soid);
- --cobc->copyfrom_readside;
+ cobc->stop_block();
kick_object_context_blocked(cobc);
}
}
copy_ops.erase(cop->obc->obs.oi.soid);
- --cop->obc->copyfrom_readside;
+ cop->obc->stop_block();
kick_object_context_blocked(cop->obc);
cop->results->should_requeue = requeue;
int unstable_writes, readers, writers_waiting, readers_waiting;
/// in-progress copyfrom ops for this object
- int copyfrom_readside;
+ bool blocked;
// set if writes for this object are blocked on another objects recovery
ObjectContextRef blocked_by; // object blocking our writes
destructor_callback(0),
lock("ReplicatedPG::ObjectContext::lock"),
unstable_writes(0), readers(0), writers_waiting(0), readers_waiting(0),
- copyfrom_readside(0) {}
+ blocked(false) {}
~ObjectContext() {
assert(rwstate.empty());
destructor_callback->complete(0);
}
+ void start_block() {
+ assert(!blocked);
+ blocked = true;
+ }
+ void stop_block() {
+ assert(blocked);
+ blocked = false;
+ }
bool is_blocked() const {
- return copyfrom_readside > 0;
+ return blocked;
}
// do simple synchronous mutual exclusion, for now. now waitqueues or anything fancy.