@@ -6737,11 +6737,10 @@ bfq_split_bfqq(struct bfq_io_cq *bic, struct bfq_queue *bfqq)
67376737 return NULL ;
67386738}
67396739
6740- static struct bfq_queue * bfq_get_bfqq_handle_split (struct bfq_data * bfqd ,
6741- struct bfq_io_cq * bic ,
6742- struct bio * bio ,
6743- bool split , bool is_sync ,
6744- bool * new_queue )
6740+ static struct bfq_queue *
6741+ __bfq_get_bfqq_handle_split (struct bfq_data * bfqd , struct bfq_io_cq * bic ,
6742+ struct bio * bio , bool split , bool is_sync ,
6743+ bool * new_queue )
67456744{
67466745 unsigned int act_idx = bfq_actuator_index (bfqd , bio );
67476746 struct bfq_queue * bfqq = bic_to_bfqq (bic , is_sync , act_idx );
@@ -6845,6 +6844,59 @@ static struct bfq_queue *bfq_waker_bfqq(struct bfq_queue *bfqq)
68456844 return waker_bfqq ;
68466845}
68476846
6847+ static struct bfq_queue * bfq_get_bfqq_handle_split (struct bfq_data * bfqd ,
6848+ struct bfq_io_cq * bic ,
6849+ struct bio * bio ,
6850+ unsigned int idx ,
6851+ bool is_sync )
6852+ {
6853+ struct bfq_queue * waker_bfqq ;
6854+ struct bfq_queue * bfqq ;
6855+ bool new_queue = false;
6856+
6857+ bfqq = __bfq_get_bfqq_handle_split (bfqd , bic , bio , false, is_sync ,
6858+ & new_queue );
6859+ if (unlikely (new_queue ))
6860+ return bfqq ;
6861+
6862+ /* If the queue was seeky for too long, break it apart. */
6863+ if (!bfq_bfqq_coop (bfqq ) || !bfq_bfqq_split_coop (bfqq ) ||
6864+ bic -> bfqq_data [idx ].stably_merged )
6865+ return bfqq ;
6866+
6867+ waker_bfqq = bfq_waker_bfqq (bfqq );
6868+
6869+ /* Update bic before losing reference to bfqq */
6870+ if (bfq_bfqq_in_large_burst (bfqq ))
6871+ bic -> bfqq_data [idx ].saved_in_large_burst = true;
6872+
6873+ bfqq = bfq_split_bfqq (bic , bfqq );
6874+ if (bfqq ) {
6875+ bfq_bfqq_resume_state (bfqq , bfqd , bic , true);
6876+ return bfqq ;
6877+ }
6878+
6879+ bfqq = __bfq_get_bfqq_handle_split (bfqd , bic , bio , true, is_sync , NULL );
6880+ if (unlikely (bfqq == & bfqd -> oom_bfqq ))
6881+ return bfqq ;
6882+
6883+ bfq_bfqq_resume_state (bfqq , bfqd , bic , false);
6884+ bfqq -> waker_bfqq = waker_bfqq ;
6885+ bfqq -> tentative_waker_bfqq = NULL ;
6886+
6887+ /*
6888+ * If the waker queue disappears, then new_bfqq->waker_bfqq must be
6889+ * reset. So insert new_bfqq into the
6890+ * woken_list of the waker. See
6891+ * bfq_check_waker for details.
6892+ */
6893+ if (waker_bfqq )
6894+ hlist_add_head (& bfqq -> woken_list_node ,
6895+ & bfqq -> waker_bfqq -> woken_list );
6896+
6897+ return bfqq ;
6898+ }
6899+
68486900/*
68496901 * If needed, init rq, allocate bfq data structures associated with
68506902 * rq, and increment reference counters in the destination bfq_queue
@@ -6876,7 +6928,6 @@ static struct bfq_queue *bfq_init_rq(struct request *rq)
68766928 struct bfq_io_cq * bic ;
68776929 const int is_sync = rq_is_sync (rq );
68786930 struct bfq_queue * bfqq ;
6879- bool new_queue = false;
68806931 unsigned int a_idx = bfq_actuator_index (bfqd , bio );
68816932
68826933 if (unlikely (!rq -> elv .icq ))
@@ -6893,53 +6944,9 @@ static struct bfq_queue *bfq_init_rq(struct request *rq)
68936944 return RQ_BFQQ (rq );
68946945
68956946 bic = icq_to_bic (rq -> elv .icq );
6896-
68976947 bfq_check_ioprio_change (bic , bio );
6898-
68996948 bfq_bic_update_cgroup (bic , bio );
6900-
6901- bfqq = bfq_get_bfqq_handle_split (bfqd , bic , bio , false, is_sync ,
6902- & new_queue );
6903-
6904- if (likely (!new_queue )) {
6905- /* If the queue was seeky for too long, break it apart. */
6906- if (bfq_bfqq_coop (bfqq ) && bfq_bfqq_split_coop (bfqq ) &&
6907- !bic -> bfqq_data [a_idx ].stably_merged ) {
6908- struct bfq_queue * waker_bfqq = bfq_waker_bfqq (bfqq );
6909-
6910- /* Update bic before losing reference to bfqq */
6911- if (bfq_bfqq_in_large_burst (bfqq ))
6912- bic -> bfqq_data [a_idx ].saved_in_large_burst =
6913- true;
6914-
6915- bfqq = bfq_split_bfqq (bic , bfqq );
6916- if (!bfqq ) {
6917- bfqq = bfq_get_bfqq_handle_split (bfqd , bic , bio ,
6918- true, is_sync ,
6919- NULL );
6920- if (likely (bfqq != & bfqd -> oom_bfqq )) {
6921- bfq_bfqq_resume_state (bfqq , bfqd , bic ,
6922- false);
6923- bfqq -> waker_bfqq = waker_bfqq ;
6924- bfqq -> tentative_waker_bfqq = NULL ;
6925-
6926- /*
6927- * If the waker queue disappears, then
6928- * new_bfqq->waker_bfqq must be
6929- * reset. So insert new_bfqq into the
6930- * woken_list of the waker. See
6931- * bfq_check_waker for details.
6932- */
6933- if (waker_bfqq )
6934- hlist_add_head (
6935- & bfqq -> woken_list_node ,
6936- & bfqq -> waker_bfqq -> woken_list );
6937- }
6938- } else {
6939- bfq_bfqq_resume_state (bfqq , bfqd , bic , true);
6940- }
6941- }
6942- }
6949+ bfqq = bfq_get_bfqq_handle_split (bfqd , bic , bio , a_idx , is_sync );
69436950
69446951 bfqq_request_allocated (bfqq );
69456952 bfqq -> ref ++ ;
0 commit comments