Merge tag 'dt-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
[linux-2.6-microblaze.git] / block / bfq-iosched.c
index 7279559..480e1a1 100644 (file)
@@ -2361,6 +2361,9 @@ static int bfq_request_merge(struct request_queue *q, struct request **req,
        __rq = bfq_find_rq_fmerge(bfqd, bio, q);
        if (__rq && elv_bio_merge_ok(__rq, bio)) {
                *req = __rq;
+
+               if (blk_discard_mergable(__rq))
+                       return ELEVATOR_DISCARD_MERGE;
                return ELEVATOR_FRONT_MERGE;
        }
 
@@ -2505,7 +2508,7 @@ void bfq_end_wr_async_queues(struct bfq_data *bfqd,
        int i, j;
 
        for (i = 0; i < 2; i++)
-               for (j = 0; j < IOPRIO_BE_NR; j++)
+               for (j = 0; j < IOPRIO_NR_LEVELS; j++)
                        if (bfqg->async_bfqq[i][j])
                                bfq_bfqq_end_wr(bfqg->async_bfqq[i][j]);
        if (bfqg->async_idle_bfqq)
@@ -5266,8 +5269,8 @@ bfq_set_next_ioprio_data(struct bfq_queue *bfqq, struct bfq_io_cq *bic)
        switch (ioprio_class) {
        default:
                pr_err("bdi %s: bfq: bad prio class %d\n",
-                               bdi_dev_name(bfqq->bfqd->queue->backing_dev_info),
-                               ioprio_class);
+                       bdi_dev_name(bfqq->bfqd->queue->disk->bdi),
+                       ioprio_class);
                fallthrough;
        case IOPRIO_CLASS_NONE:
                /*
@@ -5290,10 +5293,10 @@ bfq_set_next_ioprio_data(struct bfq_queue *bfqq, struct bfq_io_cq *bic)
                break;
        }
 
-       if (bfqq->new_ioprio >= IOPRIO_BE_NR) {
+       if (bfqq->new_ioprio >= IOPRIO_NR_LEVELS) {
                pr_crit("bfq_set_next_ioprio_data: new_ioprio %d\n",
                        bfqq->new_ioprio);
-               bfqq->new_ioprio = IOPRIO_BE_NR;
+               bfqq->new_ioprio = IOPRIO_NR_LEVELS - 1;
        }
 
        bfqq->entity.new_weight = bfq_ioprio_to_weight(bfqq->new_ioprio);
@@ -5408,7 +5411,7 @@ static struct bfq_queue **bfq_async_queue_prio(struct bfq_data *bfqd,
        case IOPRIO_CLASS_RT:
                return &bfqg->async_bfqq[0][ioprio];
        case IOPRIO_CLASS_NONE:
-               ioprio = IOPRIO_NORM;
+               ioprio = IOPRIO_BE_NORM;
                fallthrough;
        case IOPRIO_CLASS_BE:
                return &bfqg->async_bfqq[1][ioprio];
@@ -6822,7 +6825,7 @@ void bfq_put_async_queues(struct bfq_data *bfqd, struct bfq_group *bfqg)
        int i, j;
 
        for (i = 0; i < 2; i++)
-               for (j = 0; j < IOPRIO_BE_NR; j++)
+               for (j = 0; j < IOPRIO_NR_LEVELS; j++)
                        __bfq_put_async_bfqq(bfqd, &bfqg->async_bfqq[i][j]);
 
        __bfq_put_async_bfqq(bfqd, &bfqg->async_idle_bfqq);