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();
|
lock.Lock();
|
||||||
uint64_t op = ++op_seq;
|
uint64_t op = ++op_seq;
|
||||||
dout(10) << "op_submit_start " << op << dendl;
|
dout(10) << "op_submit_start " << op << dendl;
|
||||||
ops_submitting.push_back(op);
|
|
||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
|
|
||||||
void JournalingObjectStore::SubmitManager::op_submit_finish(uint64_t op)
|
void JournalingObjectStore::SubmitManager::op_submit_finish(uint64_t op)
|
||||||
{
|
{
|
||||||
dout(10) << "op_submit_finish " << op << dendl;
|
dout(10) << "op_submit_finish " << op << dendl;
|
||||||
if (op != ops_submitting.front()) {
|
if (op != op_submitted + 1) {
|
||||||
dout(0) << "op_submit_finish " << op << " expected "
|
dout(0) << "op_submit_finish " << op << " expected " << (op_submitted + 1)
|
||||||
<< ops_submitting.front()
|
|
||||||
<< ", OUT OF ORDER" << dendl;
|
<< ", OUT OF ORDER" << dendl;
|
||||||
assert(0 == "out of order op_submit_finish");
|
assert(0 == "out of order op_submit_finish");
|
||||||
}
|
}
|
||||||
ops_submitting.pop_front();
|
op_submitted = op;
|
||||||
lock.Unlock();
|
lock.Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,17 +28,17 @@ protected:
|
|||||||
class SubmitManager {
|
class SubmitManager {
|
||||||
Mutex lock;
|
Mutex lock;
|
||||||
uint64_t op_seq;
|
uint64_t op_seq;
|
||||||
list<uint64_t> ops_submitting;
|
uint64_t op_submitted;
|
||||||
public:
|
public:
|
||||||
SubmitManager() :
|
SubmitManager() :
|
||||||
lock("JOS::SubmitManager::lock", false, true, false, g_ceph_context),
|
lock("JOS::SubmitManager::lock", false, true, false, g_ceph_context),
|
||||||
op_seq(0)
|
op_seq(0), op_submitted(0)
|
||||||
{}
|
{}
|
||||||
uint64_t op_submit_start();
|
uint64_t op_submit_start();
|
||||||
void op_submit_finish(uint64_t op);
|
void op_submit_finish(uint64_t op);
|
||||||
void set_op_seq(uint64_t seq) {
|
void set_op_seq(uint64_t seq) {
|
||||||
Mutex::Locker l(lock);
|
Mutex::Locker l(lock);
|
||||||
op_seq = seq;
|
op_submitted = op_seq = seq;
|
||||||
}
|
}
|
||||||
uint64_t get_op_seq() {
|
uint64_t get_op_seq() {
|
||||||
return op_seq;
|
return op_seq;
|
||||||
|
Loading…
Reference in New Issue
Block a user