mirror of
https://github.com/ceph/ceph
synced 2025-02-24 03:27:10 +00:00
os/JournalingObjectStore: simplify op_submitting sanity check
A list is overkill; just use a seq and make sure it increments to ensure the op_submit_finish calls are in order. Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
a88b584933
commit
f66fe7783e
@ -138,20 +138,18 @@ uint64_t JournalingObjectStore::SubmitManager::op_submit_start()
|
||||
lock.Lock();
|
||||
uint64_t op = ++op_seq;
|
||||
dout(10) << "op_submit_start " << op << dendl;
|
||||
ops_submitting.push_back(op);
|
||||
return op;
|
||||
}
|
||||
|
||||
void JournalingObjectStore::SubmitManager::op_submit_finish(uint64_t op)
|
||||
{
|
||||
dout(10) << "op_submit_finish " << op << dendl;
|
||||
if (op != ops_submitting.front()) {
|
||||
dout(0) << "op_submit_finish " << op << " expected "
|
||||
<< ops_submitting.front()
|
||||
if (op != op_submitted + 1) {
|
||||
dout(0) << "op_submit_finish " << op << " expected " << (op_submitted + 1)
|
||||
<< ", OUT OF ORDER" << dendl;
|
||||
assert(0 == "out of order op_submit_finish");
|
||||
}
|
||||
ops_submitting.pop_front();
|
||||
op_submitted = op;
|
||||
lock.Unlock();
|
||||
}
|
||||
|
||||
|
@ -28,17 +28,17 @@ protected:
|
||||
class SubmitManager {
|
||||
Mutex lock;
|
||||
uint64_t op_seq;
|
||||
list<uint64_t> ops_submitting;
|
||||
uint64_t op_submitted;
|
||||
public:
|
||||
SubmitManager() :
|
||||
lock("JOS::SubmitManager::lock", false, true, false, g_ceph_context),
|
||||
op_seq(0)
|
||||
op_seq(0), op_submitted(0)
|
||||
{}
|
||||
uint64_t op_submit_start();
|
||||
void op_submit_finish(uint64_t op);
|
||||
void set_op_seq(uint64_t seq) {
|
||||
Mutex::Locker l(lock);
|
||||
op_seq = seq;
|
||||
op_submitted = op_seq = seq;
|
||||
}
|
||||
uint64_t get_op_seq() {
|
||||
return op_seq;
|
||||
|
Loading…
Reference in New Issue
Block a user