[PATCH for-6.12 5/7] block, bfq: remove local variable 'split' in bfq_init_rq()

From: Yu Kuai
Date: Mon Sep 09 2024 - 09:44:49 EST


From: Yu Kuai <yukuai3@xxxxxxxxxx>

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@xxxxxxxxxx>
---
block/bfq-iosched.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index 17b0bf6b56bb..54f6eae2763d 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -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
--
2.39.2