block, bfq: remove local variable 'split' in bfq_init_rq()
authorYu Kuai <yukuai3@huawei.com>
Mon, 9 Sep 2024 13:41:52 +0000 (21:41 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 10 Sep 2024 22:32:09 +0000 (16:32 -0600)
The local variable is used to call bfq_bfqq_resume_state() later,
since 'bfqd->lock' is held, and bfqq status will not change between
setting 'split' and calling bfq_bfqq_resume_state(), move forward
bfq_bfqq_resume_state() so that 'split' can be removed. There are no
functional chagnes.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Link: https://lore.kernel.org/r/20240909134154.954924-6-yukuai1@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bfq-iosched.c

index 17b0bf6b56bb642059504725bdc1d5f84bedbef1..54f6eae2763d9f3688428dd2a56a8afb2a33be6c 100644 (file)
@@ -6877,7 +6877,7 @@ static struct bfq_queue *bfq_init_rq(struct request *rq)
        const int is_sync = rq_is_sync(rq);
        struct bfq_queue *bfqq;
        bool new_queue = false;
-       bool bfqq_already_existing = false, split = false;
+       bool bfqq_already_existing = false;
        unsigned int a_idx = bfq_actuator_index(bfqd, bio);
 
        if (unlikely(!rq->elv.icq))
@@ -6914,16 +6914,19 @@ static struct bfq_queue *bfq_init_rq(struct request *rq)
                                        true;
 
                        bfqq = bfq_split_bfqq(bic, bfqq);
-                       split = true;
-
                        if (!bfqq) {
                                bfqq = bfq_get_bfqq_handle_split(bfqd, bic, bio,
                                                                 true, is_sync,
                                                                 NULL);
                                if (unlikely(bfqq == &bfqd->oom_bfqq))
                                        bfqq_already_existing = true;
-                       } else
+                               else
+                                       bfq_bfqq_resume_state(bfqq, bfqd, bic,
+                                                             false);
+                       } else {
                                bfqq_already_existing = true;
+                               bfq_bfqq_resume_state(bfqq, bfqd, bic, true);
+                       }
 
                        if (!bfqq_already_existing) {
                                bfqq->waker_bfqq = waker_bfqq;
@@ -6959,18 +6962,8 @@ static struct bfq_queue *bfq_init_rq(struct request *rq)
         * resume its state.
         */
        if (likely(bfqq != &bfqd->oom_bfqq) && !bfqq->new_bfqq &&
-           bfqq_process_refs(bfqq) == 1) {
+           bfqq_process_refs(bfqq) == 1)
                bfqq->bic = bic;
-               if (split) {
-                       /*
-                        * The queue has just been split from a shared
-                        * queue: restore the idle window and the
-                        * possible weight raising period.
-                        */
-                       bfq_bfqq_resume_state(bfqq, bfqd, bic,
-                                             bfqq_already_existing);
-               }
-       }
 
        /*
         * Consider bfqq as possibly belonging to a burst of newly