parisc: switch to ->regset_get()
[linux-2.6-microblaze.git] / block / bfq-iosched.c
index 8c436ab..50c8f03 100644 (file)
 #include <linux/ioprio.h>
 #include <linux/sbitmap.h>
 #include <linux/delay.h>
+#include <linux/backing-dev.h>
 
 #include "blk.h"
 #include "blk-mq.h"
@@ -2716,8 +2717,6 @@ static void bfq_bfqq_save_state(struct bfq_queue *bfqq)
        }
 }
 
-
-static
 void bfq_release_process_ref(struct bfq_data *bfqd, struct bfq_queue *bfqq)
 {
        /*
@@ -4978,8 +4977,9 @@ bfq_set_next_ioprio_data(struct bfq_queue *bfqq, struct bfq_io_cq *bic)
        ioprio_class = IOPRIO_PRIO_CLASS(bic->ioprio);
        switch (ioprio_class) {
        default:
-               dev_err(bfqq->bfqd->queue->backing_dev_info->dev,
-                       "bfq: bad prio class %d\n", ioprio_class);
+               pr_err("bdi %s: bfq: bad prio class %d\n",
+                               bdi_dev_name(bfqq->bfqd->queue->backing_dev_info),
+                               ioprio_class);
                /* fall through */
        case IOPRIO_CLASS_NONE:
                /*
@@ -6073,7 +6073,7 @@ static struct bfq_queue *bfq_get_bfqq_handle_split(struct bfq_data *bfqd,
  * comments on bfq_init_rq for the reason behind this delayed
  * preparation.
  */
-static void bfq_prepare_request(struct request *rq, struct bio *bio)
+static void bfq_prepare_request(struct request *rq)
 {
        /*
         * Regardless of whether we have an icq attached, we have to
@@ -6215,20 +6215,28 @@ static struct bfq_queue *bfq_init_rq(struct request *rq)
        return bfqq;
 }
 
-static void bfq_idle_slice_timer_body(struct bfq_queue *bfqq)
+static void
+bfq_idle_slice_timer_body(struct bfq_data *bfqd, struct bfq_queue *bfqq)
 {
-       struct bfq_data *bfqd = bfqq->bfqd;
        enum bfqq_expiration reason;
        unsigned long flags;
 
        spin_lock_irqsave(&bfqd->lock, flags);
-       bfq_clear_bfqq_wait_request(bfqq);
 
+       /*
+        * Considering that bfqq may be in race, we should firstly check
+        * whether bfqq is in service before doing something on it. If
+        * the bfqq in race is not in service, it has already been expired
+        * through __bfq_bfqq_expire func and its wait_request flags has
+        * been cleared in __bfq_bfqd_reset_in_service func.
+        */
        if (bfqq != bfqd->in_service_queue) {
                spin_unlock_irqrestore(&bfqd->lock, flags);
                return;
        }
 
+       bfq_clear_bfqq_wait_request(bfqq);
+
        if (bfq_bfqq_budget_timeout(bfqq))
                /*
                 * Also here the queue can be safely expired
@@ -6273,7 +6281,7 @@ static enum hrtimer_restart bfq_idle_slice_timer(struct hrtimer *timer)
         * early.
         */
        if (bfqq)
-               bfq_idle_slice_timer_body(bfqq);
+               bfq_idle_slice_timer_body(bfqd, bfqq);
 
        return HRTIMER_NORESTART;
 }