block, bfq: use bfq_reassign_last_bfqq() in bfq_bfqq_move()
authorYu Kuai <yukuai3@huawei.com>
Mon, 2 Sep 2024 13:03:29 +0000 (21:03 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 3 Sep 2024 15:51:54 +0000 (09:51 -0600)
Instead of open coding it, there are no functional changes.

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

index b758693697c093f5d869c76838c6124d3032e8f2..9fb9f353315025a4004b8097bb138ddfe34a0dd2 100644 (file)
@@ -679,12 +679,7 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq,
                bfq_put_idle_entity(bfq_entity_service_tree(entity), entity);
        bfqg_and_blkg_put(old_parent);
 
-       if (entity->parent &&
-           entity->parent->last_bfqq_created == bfqq)
-               entity->parent->last_bfqq_created = NULL;
-       else if (bfqd->last_bfqq_created == bfqq)
-               bfqd->last_bfqq_created = NULL;
-
+       bfq_reassign_last_bfqq(bfqq, NULL);
        entity->parent = bfqg->my_entity;
        entity->sched_data = &bfqg->sched_data;
        /* pin down bfqg and its associated blkg  */
index ca766b7d5560ef5e3638df818a7f50b42a747c9a..d1bf2b8a35769f44cd56cae0347d39d32dd711eb 100644 (file)
@@ -3097,8 +3097,8 @@ static void bfq_bfqq_save_state(struct bfq_queue *bfqq)
 }
 
 
-static void
-bfq_reassign_last_bfqq(struct bfq_queue *cur_bfqq, struct bfq_queue *new_bfqq)
+void bfq_reassign_last_bfqq(struct bfq_queue *cur_bfqq,
+                           struct bfq_queue *new_bfqq)
 {
        if (cur_bfqq->entity.parent &&
            cur_bfqq->entity.parent->last_bfqq_created == cur_bfqq)
index 08ddf2cfae5b1cce03f5c0285f0b3d62401b7983..e16d96e2367bf37fde3df1e00c52b571678ab891 100644 (file)
@@ -1156,6 +1156,8 @@ void bfq_del_bfqq_busy(struct bfq_queue *bfqq, bool expiration);
 void bfq_add_bfqq_busy(struct bfq_queue *bfqq);
 void bfq_add_bfqq_in_groups_with_pending_reqs(struct bfq_queue *bfqq);
 void bfq_del_bfqq_in_groups_with_pending_reqs(struct bfq_queue *bfqq);
+void bfq_reassign_last_bfqq(struct bfq_queue *cur_bfqq,
+                           struct bfq_queue *new_bfqq);
 
 /* --------------- end of interface of B-WF2Q+ ---------------- */