block, bfq: inject I/O to underutilized actuators
[linux-2.6-microblaze.git] / block / bfq-iosched.h
index ba2ece8..2b4893a 100644 (file)
@@ -590,7 +590,12 @@ struct bfq_data {
        /* number of queued requests */
        int queued;
        /* number of requests dispatched and waiting for completion */
-       int rq_in_driver;
+       int tot_rq_in_driver;
+       /*
+        * number of requests dispatched and waiting for completion
+        * for each actuator
+        */
+       int rq_in_driver[BFQ_MAX_ACTUATORS];
 
        /* true if the device is non rotational and performs queueing */
        bool nonrot_with_queueing;
@@ -684,8 +689,13 @@ struct bfq_data {
        /* maximum budget allotted to a bfq_queue before rescheduling */
        int bfq_max_budget;
 
-       /* list of all the bfq_queues active on the device */
-       struct list_head active_list;
+       /*
+        * List of all the bfq_queues active for a specific actuator
+        * on the device. Keeping active queues separate on a
+        * per-actuator basis helps implementing per-actuator
+        * injection more efficiently.
+        */
+       struct list_head active_list[BFQ_MAX_ACTUATORS];
        /* list of all the bfq_queues idle on the device */
        struct list_head idle_list;
 
@@ -821,6 +831,29 @@ struct bfq_data {
        sector_t sector[BFQ_MAX_ACTUATORS];
        sector_t nr_sectors[BFQ_MAX_ACTUATORS];
        struct blk_independent_access_range ia_ranges[BFQ_MAX_ACTUATORS];
+
+       /*
+        * If the number of I/O requests queued in the device for a
+        * given actuator is below next threshold, then the actuator
+        * is deemed as underutilized. If this condition is found to
+        * hold for some actuator upon a dispatch, but (i) the
+        * in-service queue does not contain I/O for that actuator,
+        * while (ii) some other queue does contain I/O for that
+        * actuator, then the head I/O request of the latter queue is
+        * returned (injected), instead of the head request of the
+        * currently in-service queue.
+        *
+        * We set the threshold, empirically, to the minimum possible
+        * value for which an actuator is fully utilized, or close to
+        * be fully utilized. By doing so, injected I/O 'steals' as
+        * few drive-queue slots as possibile to the in-service
+        * queue. This reduces as much as possible the probability
+        * that the service of I/O from the in-service bfq_queue gets
+        * delayed because of slot exhaustion, i.e., because all the
+        * slots of the drive queue are filled with I/O injected from
+        * other queues (NCQ provides for 32 slots).
+        */
+       unsigned int actuator_load_threshold;
 };
 
 enum bfqq_state_flags {