using compact_map = compact_map<k, v, cmp, \
pool_allocator<std::pair<const k,v>>>; \
\
+ template<typename k,typename v, typename cmp = std::less<k> > \
+ using compact_multimap = compact_multimap<k, v, cmp, \
+ pool_allocator<std::pair<const k,v>>>; \
+ \
template<typename k, typename cmp = std::less<k> > \
using compact_set = compact_set<k, cmp, pool_allocator<k>>; \
\
#include "common/config.h"
#include "include/Context.h"
-#include "include/alloc_ptr.h"
#include "include/assert.h"
#include "include/mempool.h"
#include "include/types.h"
// ---------------------------------------------
// waiting
private:
- alloc_ptr<mempool::mds_co::multimap<uint64_t, std::pair<uint64_t, MDSInternalContextBase*>>> waiting;
+ mempool::mds_co::compact_multimap<uint64_t, std::pair<uint64_t, MDSInternalContextBase*>> waiting;
static uint64_t last_wait_seq;
public:
while (min & (min-1)) // if more than one bit is set
min &= min-1; // clear LSB
}
- if (waiting) {
- for (auto p = waiting->lower_bound(min); p != waiting->end(); ++p) {
- if (p->first & mask) return true;
- if (p->first > mask) return false;
- }
+ for (auto p = waiting.lower_bound(min); p != waiting.end(); ++p) {
+ if (p->first & mask) return true;
+ if (p->first > mask) return false;
}
return false;
}
virtual void add_waiter(uint64_t mask, MDSInternalContextBase *c) {
- if (waiting->empty())
+ if (waiting.empty())
get(PIN_WAITER);
uint64_t seq = 0;
seq = ++last_wait_seq;
mask &= ~WAIT_ORDERED;
}
- waiting->insert(pair<uint64_t, pair<uint64_t, MDSInternalContextBase*> >(
+ waiting.insert(pair<uint64_t, pair<uint64_t, MDSInternalContextBase*> >(
mask,
pair<uint64_t, MDSInternalContextBase*>(seq, c)));
// pdout(10,g_conf()->debug_mds) << (mdsco_db_line_prefix(this))
}
virtual void take_waiting(uint64_t mask, std::list<MDSInternalContextBase*>& ls) {
- if (!waiting || waiting->empty()) return;
+ if (waiting.empty()) return;
// process ordered waiters in the same order that they were added.
std::map<uint64_t, MDSInternalContextBase*> ordered_waiters;
- for (auto it = waiting->begin(); it != waiting->end(); ) {
+ for (auto it = waiting.begin(); it != waiting.end(); ) {
if (it->first & mask) {
if (it->second.first > 0) {
ordered_waiters.insert(it->second);
// << " tag " << hex << it->first << dec
// << " on " << *this
// << dendl;
- waiting->erase(it++);
+ waiting.erase(it++);
} else {
// pdout(10,g_conf()->debug_mds) << "take_waiting mask " << hex << mask << dec << " SKIPPING " << it->second
// << " tag " << hex << it->first << dec
for (auto it = ordered_waiters.begin(); it != ordered_waiters.end(); ++it) {
ls.push_back(it->second);
}
- if (waiting->empty()) {
+ if (waiting.empty()) {
put(PIN_WAITER);
- waiting.reset();
+ waiting.clear();
}
}
void finish_waiting(uint64_t mask, int result = 0);