}
}
-void Client::wait_on_context_list(list<Context*>& ls)
+void Client::wait_on_context_list(std::vector<Context*>& ls)
{
ceph::condition_variable cond;
bool done = false;
l.release();
}
-void Client::signal_context_list(list<Context*>& ls)
-{
- while (!ls.empty()) {
- ls.front()->complete(0);
- ls.pop_front();
- }
-}
-
void Client::signal_caps_inode(Inode *in)
{
// Process the waitfor_caps list
- while (!in->waitfor_caps.empty()) {
- in->waitfor_caps.front()->complete(0);
- in->waitfor_caps.pop_front();
- }
+ signal_context_list(in->waitfor_caps);
// New items may have been added to the pending list, move them onto the
// waitfor_caps list
- while (!in->waitfor_caps_pending.empty()) {
- Context *ctx = in->waitfor_caps_pending.front();
-
- in->waitfor_caps_pending.pop_front();
- in->waitfor_caps.push_back(ctx);
- }
+ std::swap(in->waitfor_caps, in->waitfor_caps_pending);
}
void Client::wake_up_session_caps(MetaSession *s, bool reconnect)
ldout(clnt->cct, 15) << "waiting on unsafe requests, last tid " << req->get_tid() << dendl;
req->get();
- clnt->add_nonblocking_onfinish_to_context_list(req->waitfor_safe, advancer);
+ req->waitfor_safe.push_back(advancer);
// ------------ here is a state machine break point
return;
}
ldout(clnt->cct, 10) << "ino " << in->ino << " has " << in->cap_refs[CEPH_CAP_FILE_BUFFER]
<< " uncommitted, waiting" << dendl;
advancer = new C_nonblocking_fsync_state_advancer(clnt, this);
- clnt->add_nonblocking_onfinish_to_context_list(in->waitfor_commit, advancer);
+ in->waitfor_commit.push_back(advancer);
// ------------ here is a state machine break point but we have to
// return to this case because this might loop.
progress = 1;
<< " for C_nonblocking_fsync_state " << this
<< dendl;
if (progress == 3)
- clnt->add_nonblocking_onfinish_to_context_list(in->waitfor_caps, advancer);
+ in->waitfor_caps.push_back(advancer);
else
- clnt->add_nonblocking_onfinish_to_context_list(in->waitfor_caps_pending, advancer);
+ in->waitfor_caps_pending.push_back(advancer);
// ------------ here is a state machine break point
// the advancer completion will resume with case 3
progress = 4;
case MetaSession::STATE_OPENING:
{
ldout(cct, 1) << "reset from mds we were opening; retrying" << dendl;
- list<Context*> waiters;
+ std::vector<Context*> waiters;
waiters.swap(s->waiting_for_open);
_closed_mds_session(s.get());
auto news = _get_or_open_mds_session(mds);
// helpers
void wake_up_session_caps(MetaSession *s, bool reconnect);
- void add_nonblocking_onfinish_to_context_list(std::list<Context*>& ls, Context *onfinish) {
- ls.push_back(onfinish);
+ void wait_on_context_list(std::vector<Context*>& ls);
+ void signal_context_list(std::vector<Context*>& ls) {
+ finish_contexts(cct, ls, 0);
}
- void wait_on_context_list(std::list<Context*>& ls);
- void signal_context_list(std::list<Context*>& ls);
void signal_caps_inode(Inode *in);
// -- metadata cache stuff
std::map<frag_t,int> fragmap; // known frag -> mds mappings
std::map<frag_t, std::vector<mds_rank_t>> frag_repmap; // non-auth mds mappings
- std::list<Context*> waitfor_caps;
- std::list<Context*> waitfor_caps_pending;
- std::list<Context*> waitfor_commit;
+ std::vector<Context*> waitfor_caps;
+ std::vector<Context*> waitfor_caps_pending;
+ std::vector<Context*> waitfor_commit;
std::list<ceph::condition_variable*> waitfor_deleg;
Dentry *get_first_parent() {