cfq: Make use of service count to estimate the rb_key offset
[linux-2.6.git] / block / cfq-iosched.c
index 1bcbd8c..467981e 100644 (file)
@@ -600,11 +600,15 @@ cfq_find_next_rq(struct cfq_data *cfqd, struct cfq_queue *cfqq,
 static unsigned long cfq_slice_offset(struct cfq_data *cfqd,
                                      struct cfq_queue *cfqq)
 {
+       struct cfq_rb_root *service_tree;
+
+       service_tree = service_tree_for(cfqq_prio(cfqq), cfqq_type(cfqq), cfqd);
+
        /*
         * just an approximation, should be ok.
         */
-       return (cfqd->busy_queues - 1) * (cfq_prio_slice(cfqd, 1, 0) -
-                      cfq_prio_slice(cfqd, cfq_cfqq_sync(cfqq), cfqq->ioprio));
+       return  service_tree->count * (cfq_prio_slice(cfqd, 1, 0) -
+                  cfq_prio_slice(cfqd, cfq_cfqq_sync(cfqq), cfqq->ioprio));
 }
 
 /*