From: Sage Weil Date: Mon, 21 Jan 2013 22:52:54 +0000 (-0800) Subject: common/PrioritizedQueue: buckets -> tokens X-Git-Tag: v0.57~146^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c549a0cf6fae78c8418a3b4b0702fd8a1e4ce482;p=ceph.git common/PrioritizedQueue: buckets -> tokens Signed-off-by: Sage Weil --- diff --git a/src/common/PrioritizedQueue.h b/src/common/PrioritizedQueue.h index 9c27ddc3860a..6ada06601246 100644 --- a/src/common/PrioritizedQueue.h +++ b/src/common/PrioritizedQueue.h @@ -76,22 +76,22 @@ class PrioritizedQueue { struct SubQueue { private: map > > q; - unsigned bucket; + unsigned tokens; int64_t size; typename map > >::iterator cur; public: SubQueue(const SubQueue &other) - : q(other.q), bucket(other.bucket), size(other.size), + : q(other.q), tokens(other.tokens), size(other.size), cur(q.begin()) {} - SubQueue() : bucket(0), size(0), cur(q.begin()) {} + SubQueue() : tokens(0), size(0), cur(q.begin()) {} unsigned num_tokens() const { - return bucket; + return tokens; } - void put_tokens(unsigned tokens) { - bucket += tokens; + void put_tokens(unsigned t) { + tokens += t; } - void take_tokens(unsigned tokens) { - bucket -= tokens; + void take_tokens(unsigned t) { + tokens -= t; } void enqueue(K cl, unsigned cost, T item) { q[cl].push_back(make_pair(cost, item));