ASoC: Intel: Skylake: Fix struct definition
[platform/kernel/linux-starfive.git] / block / bfq-cgroup.c
index 7d624a3..1b2829e 100644 (file)
@@ -224,7 +224,7 @@ void bfqg_stats_update_io_add(struct bfq_group *bfqg, struct bfq_queue *bfqq,
 {
        blkg_rwstat_add(&bfqg->stats.queued, opf, 1);
        bfqg_stats_end_empty_time(&bfqg->stats);
-       if (!(bfqq == ((struct bfq_data *)bfqg->bfqd)->in_service_queue))
+       if (!(bfqq == bfqg->bfqd->in_service_queue))
                bfqg_stats_set_start_group_wait_time(bfqg, bfqq_group(bfqq));
 }
 
@@ -552,6 +552,7 @@ static void bfq_pd_init(struct blkg_policy_data *pd)
                                   */
        bfqg->bfqd = bfqd;
        bfqg->active_entities = 0;
+       bfqg->num_queues_with_pending_reqs = 0;
        bfqg->online = true;
        bfqg->rq_pos_tree = RB_ROOT;
 }
@@ -645,6 +646,7 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq,
 {
        struct bfq_entity *entity = &bfqq->entity;
        struct bfq_group *old_parent = bfqq_group(bfqq);
+       bool has_pending_reqs = false;
 
        /*
         * No point to move bfqq to the same group, which can happen when
@@ -665,6 +667,11 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq,
         */
        bfqq->ref++;
 
+       if (entity->in_groups_with_pending_reqs) {
+               has_pending_reqs = true;
+               bfq_del_bfqq_in_groups_with_pending_reqs(bfqq);
+       }
+
        /* If bfqq is empty, then bfq_bfqq_expire also invokes
         * bfq_del_bfqq_busy, thereby removing bfqq and its entity
         * from data structures related to current group. Otherwise we
@@ -692,6 +699,9 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq,
        /* pin down bfqg and its associated blkg  */
        bfqg_and_blkg_get(bfqg);
 
+       if (has_pending_reqs)
+               bfq_add_bfqq_in_groups_with_pending_reqs(bfqq);
+
        if (bfq_bfqq_busy(bfqq)) {
                if (unlikely(!bfqd->nonrot_with_queueing))
                        bfq_pos_tree_add_move(bfqd, bfqq);
@@ -714,19 +724,19 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq,
  * sure that the reference to cgroup is valid across the call (see
  * comments in bfq_bic_update_cgroup on this issue)
  */
-static void *__bfq_bic_change_cgroup(struct bfq_data *bfqd,
-                                    struct bfq_io_cq *bic,
-                                    struct bfq_group *bfqg)
+static void __bfq_bic_change_cgroup(struct bfq_data *bfqd,
+                                   struct bfq_io_cq *bic,
+                                   struct bfq_group *bfqg)
 {
-       struct bfq_queue *async_bfqq = bic_to_bfqq(bic, 0);
-       struct bfq_queue *sync_bfqq = bic_to_bfqq(bic, 1);
+       struct bfq_queue *async_bfqq = bic_to_bfqq(bic, false);
+       struct bfq_queue *sync_bfqq = bic_to_bfqq(bic, true);
        struct bfq_entity *entity;
 
        if (async_bfqq) {
                entity = &async_bfqq->entity;
 
                if (entity->sched_data != &bfqg->sched_data) {
-                       bic_set_bfqq(bic, NULL, 0);
+                       bic_set_bfqq(bic, NULL, false);
                        bfq_release_process_ref(bfqd, async_bfqq);
                }
        }
@@ -762,12 +772,10 @@ static void *__bfq_bic_change_cgroup(struct bfq_data *bfqd,
                                 */
                                bfq_put_cooperator(sync_bfqq);
                                bfq_release_process_ref(bfqd, sync_bfqq);
-                               bic_set_bfqq(bic, NULL, 1);
+                               bic_set_bfqq(bic, NULL, true);
                        }
                }
        }
-
-       return bfqg;
 }
 
 void bfq_bic_update_cgroup(struct bfq_io_cq *bic, struct bio *bio)