Commit e61e002a authored by Yu Kuai's avatar Yu Kuai Committed by Jens Axboe

block, bfq: remove local variable 'split' in bfq_init_rq()

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: default avatarYu Kuai <yukuai3@huawei.com>
Link: https://lore.kernel.org/r/20240909134154.954924-6-yukuai1@huaweicloud.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 553a606c
...@@ -6877,7 +6877,7 @@ static struct bfq_queue *bfq_init_rq(struct request *rq) ...@@ -6877,7 +6877,7 @@ static struct bfq_queue *bfq_init_rq(struct request *rq)
const int is_sync = rq_is_sync(rq); const int is_sync = rq_is_sync(rq);
struct bfq_queue *bfqq; struct bfq_queue *bfqq;
bool new_queue = false; 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); unsigned int a_idx = bfq_actuator_index(bfqd, bio);
if (unlikely(!rq->elv.icq)) if (unlikely(!rq->elv.icq))
...@@ -6914,16 +6914,19 @@ static struct bfq_queue *bfq_init_rq(struct request *rq) ...@@ -6914,16 +6914,19 @@ static struct bfq_queue *bfq_init_rq(struct request *rq)
true; true;
bfqq = bfq_split_bfqq(bic, bfqq); bfqq = bfq_split_bfqq(bic, bfqq);
split = true;
if (!bfqq) { if (!bfqq) {
bfqq = bfq_get_bfqq_handle_split(bfqd, bic, bio, bfqq = bfq_get_bfqq_handle_split(bfqd, bic, bio,
true, is_sync, true, is_sync,
NULL); NULL);
if (unlikely(bfqq == &bfqd->oom_bfqq)) if (unlikely(bfqq == &bfqd->oom_bfqq))
bfqq_already_existing = true; bfqq_already_existing = true;
} else else
bfq_bfqq_resume_state(bfqq, bfqd, bic,
false);
} else {
bfqq_already_existing = true; bfqq_already_existing = true;
bfq_bfqq_resume_state(bfqq, bfqd, bic, true);
}
if (!bfqq_already_existing) { if (!bfqq_already_existing) {
bfqq->waker_bfqq = waker_bfqq; bfqq->waker_bfqq = waker_bfqq;
...@@ -6959,18 +6962,8 @@ static struct bfq_queue *bfq_init_rq(struct request *rq) ...@@ -6959,18 +6962,8 @@ static struct bfq_queue *bfq_init_rq(struct request *rq)
* resume its state. * resume its state.
*/ */
if (likely(bfqq != &bfqd->oom_bfqq) && !bfqq->new_bfqq && if (likely(bfqq != &bfqd->oom_bfqq) && !bfqq->new_bfqq &&
bfqq_process_refs(bfqq) == 1) { bfqq_process_refs(bfqq) == 1)
bfqq->bic = bic; 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 * Consider bfqq as possibly belonging to a burst of newly
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment