mirror of
https://github.com/ceph/ceph
synced 2024-12-22 03:22:00 +00:00
osd: make obc copyfrom blocking generic
Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
8dec2b2735
commit
e6ad4d4a44
@ -4531,7 +4531,7 @@ void ReplicatedPG::start_copy(CopyCallback *cb, ObjectContextRef obc,
|
||||
|
||||
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);
|
||||
}
|
||||
@ -4621,7 +4621,7 @@ void ReplicatedPG::process_copy_chunk(hobject_t oid, tid_t tid, int r)
|
||||
cop->cb->complete(results);
|
||||
|
||||
copy_ops.erase(cobc->obs.oi.soid);
|
||||
--cobc->copyfrom_readside;
|
||||
cobc->stop_block();
|
||||
kick_object_context_blocked(cobc);
|
||||
}
|
||||
|
||||
@ -4774,7 +4774,7 @@ void ReplicatedPG::cancel_copy(CopyOpRef cop, bool requeue)
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -2274,7 +2274,7 @@ public:
|
||||
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
|
||||
@ -2422,7 +2422,7 @@ public:
|
||||
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());
|
||||
@ -2430,8 +2430,16 @@ public:
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user