]> git-server-git.apps.pok.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:54 +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 6dcb519da400e4d81f59fceb93098f68d908dda5..d3b46b3636cbf3e1c67910341fc0579b4d57b1ed 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);
   }