Merge branches 'acpi-scan', 'acpi-pnp' and 'acpi-sleep'
[linux-2.6-microblaze.git] / block / bfq-iosched.c
index c34b090..9e81d10 100644 (file)
@@ -4640,6 +4640,9 @@ static bool bfq_has_work(struct blk_mq_hw_ctx *hctx)
 {
        struct bfq_data *bfqd = hctx->queue->elevator->elevator_data;
 
+       if (!atomic_read(&hctx->elevator_queued))
+               return false;
+
        /*
         * Avoiding lock: a race on bfqd->busy_queues should cause at
         * most a call to dispatch for nothing
@@ -5554,6 +5557,7 @@ static void bfq_insert_requests(struct blk_mq_hw_ctx *hctx,
                rq = list_first_entry(list, struct request, queuelist);
                list_del_init(&rq->queuelist);
                bfq_insert_request(hctx, rq, at_head);
+               atomic_inc(&hctx->elevator_queued);
        }
 }
 
@@ -5895,18 +5899,6 @@ static void bfq_finish_requeue_request(struct request *rq)
        struct bfq_queue *bfqq = RQ_BFQQ(rq);
        struct bfq_data *bfqd;
 
-       /*
-        * Requeue and finish hooks are invoked in blk-mq without
-        * checking whether the involved request is actually still
-        * referenced in the scheduler. To handle this fact, the
-        * following two checks make this function exit in case of
-        * spurious invocations, for which there is nothing to do.
-        *
-        * First, check whether rq has nothing to do with an elevator.
-        */
-       if (unlikely(!(rq->rq_flags & RQF_ELVPRIV)))
-               return;
-
        /*
         * rq either is not associated with any icq, or is an already
         * requeued request that has not (yet) been re-inserted into
@@ -5933,6 +5925,7 @@ static void bfq_finish_requeue_request(struct request *rq)
 
                bfq_completed_request(bfqq, bfqd);
                bfq_finish_requeue_request_body(bfqq);
+               atomic_dec(&rq->mq_hctx->elevator_queued);
 
                spin_unlock_irqrestore(&bfqd->lock, flags);
        } else {
@@ -6372,8 +6365,8 @@ static void bfq_depth_updated(struct blk_mq_hw_ctx *hctx)
        struct blk_mq_tags *tags = hctx->sched_tags;
        unsigned int min_shallow;
 
-       min_shallow = bfq_update_depths(bfqd, &tags->bitmap_tags);
-       sbitmap_queue_min_shallow_depth(&tags->bitmap_tags, min_shallow);
+       min_shallow = bfq_update_depths(bfqd, tags->bitmap_tags);
+       sbitmap_queue_min_shallow_depth(tags->bitmap_tags, min_shallow);
 }
 
 static int bfq_init_hctx(struct blk_mq_hw_ctx *hctx, unsigned int index)