]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
PrioritizedQueue: cap costs at max_tokens_per_subqueue
authorSamuel Just <sam.just@inktank.com>
Thu, 13 Mar 2014 21:04:19 +0000 (14:04 -0700)
committerSage Weil <sage@inktank.com>
Mon, 7 Apr 2014 15:37:48 +0000 (08:37 -0700)
Otherwise, you can get a recovery op in the queue which has a cost
higher than the max token value.  It won't get serviced until all other
queues also do not have enough tokens and higher priority queues are
empty.

Fixes: #7706
Signed-off-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit 2722a0a487e77ea2aa0d18caec0bdac50cb6a264)

src/common/PrioritizedQueue.h

index e663f277693ea51a28cf3d5f6c5d32262bc8ebf6..d936d5d86c4fe1aae8c06eb4117d313460d8462d 100644 (file)
@@ -311,12 +311,16 @@ public:
   void enqueue(K cl, unsigned priority, unsigned cost, T item) {
     if (cost < min_cost)
       cost = min_cost;
+    if (cost > max_tokens_per_subqueue)
+      cost = max_tokens_per_subqueue;
     create_queue(priority)->enqueue(cl, cost, item);
   }
 
   void enqueue_front(K cl, unsigned priority, unsigned cost, T item) {
     if (cost < min_cost)
       cost = min_cost;
+    if (cost > max_tokens_per_subqueue)
+      cost = max_tokens_per_subqueue;
     create_queue(priority)->enqueue_front(cl, cost, item);
   }