#define MDS_CONTEXT_H
#include <vector>
-#include <queue>
+#include <deque>
#include "include/Context.h"
#include "include/elist.h"
using vec = vec_alloc<std::allocator>;
template<template<typename> class A>
- using que_alloc = std::queue<MDSInternalContextBase *, std::deque<MDSInternalContextBase *, A<MDSInternalContextBase *>>>;
+ using que_alloc = std::deque<MDSInternalContextBase *, A<MDSInternalContextBase *>>;
using que = que_alloc<std::allocator>;
void complete(int r) override;
{
assert(mds_lock.is_locked_by_me());
- while (!finished_queue.empty()) {
+ if (!finished_queue.empty()) {
dout(7) << "mds has " << finished_queue.size() << " queued contexts" << dendl;
- dout(10) << finished_queue << dendl;
- decltype(finished_queue) ls;
- ls.swap(finished_queue);
- for (auto& c : ls) {
- dout(10) << " finish " << c << dendl;
- c->complete(0);
+ while (!finished_queue.empty()) {
+ auto fin = finished_queue.front();
+ finished_queue.pop_front();
+
+ dout(10) << " finish " << fin << dendl;
+ fin->complete(0);
+
heartbeat_reset();
}
}
return false;
}
queue_waiter(replay_queue.front());
- replay_queue.pop();
+ replay_queue.pop_front();
return true;
}
} progress_thread;
list<Message*> waiting_for_nolaggy;
- MDSInternalContextBase::vec finished_queue;
+ MDSInternalContextBase::que finished_queue;
// Dispatch, retry, queues
int dispatch_depth;
void inc_dispatch_depth() { ++dispatch_depth; }
void queue_waiters(MDSInternalContextBase::vec& ls) {
MDSInternalContextBase::vec v;
v.swap(ls);
- finished_queue.insert(finished_queue.end(), v.begin(), v.end());
+ std::copy(v.begin(), v.end(), std::back_inserter(finished_queue));
progress_thread.signal();
}
waiting_for_mdsmap[e].push_back(c);
}
void enqueue_replay(MDSInternalContextBase *c) {
- replay_queue.push(c);
+ replay_queue.push_back(c);
}
bool queue_one_replay();