block: make QUEUE_SYSFS_BIT_FNS more useful
[linux-2.6-microblaze.git] / block / bfq-iosched.c
index a4c0bec..a251b80 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
@@ -4980,7 +4983,7 @@ bfq_set_next_ioprio_data(struct bfq_queue *bfqq, struct bfq_io_cq *bic)
                pr_err("bdi %s: bfq: bad prio class %d\n",
                                bdi_dev_name(bfqq->bfqd->queue->backing_dev_info),
                                ioprio_class);
-               /* fall through */
+               fallthrough;
        case IOPRIO_CLASS_NONE:
                /*
                 * No prio set, inherit CPU scheduling settings.
@@ -5112,7 +5115,7 @@ static struct bfq_queue **bfq_async_queue_prio(struct bfq_data *bfqd,
                return &bfqg->async_bfqq[0][ioprio];
        case IOPRIO_CLASS_NONE:
                ioprio = IOPRIO_NORM;
-               /* fall through */
+               fallthrough;
        case IOPRIO_CLASS_BE:
                return &bfqg->async_bfqq[1][ioprio];
        case IOPRIO_CLASS_IDLE:
@@ -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);
        }
 }
 
@@ -5933,6 +5937,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 +6377,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)