@@ -6737,11 +6737,10 @@ bfq_split_bfqq(struct bfq_io_cq *bic, struct bfq_queue *bfqq)
6737
6737
return NULL ;
6738
6738
}
6739
6739
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 )
6745
6744
{
6746
6745
unsigned int act_idx = bfq_actuator_index (bfqd , bio );
6747
6746
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)
6845
6844
return waker_bfqq ;
6846
6845
}
6847
6846
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
+
6848
6900
/*
6849
6901
* If needed, init rq, allocate bfq data structures associated with
6850
6902
* rq, and increment reference counters in the destination bfq_queue
@@ -6876,7 +6928,6 @@ static struct bfq_queue *bfq_init_rq(struct request *rq)
6876
6928
struct bfq_io_cq * bic ;
6877
6929
const int is_sync = rq_is_sync (rq );
6878
6930
struct bfq_queue * bfqq ;
6879
- bool new_queue = false;
6880
6931
unsigned int a_idx = bfq_actuator_index (bfqd , bio );
6881
6932
6882
6933
if (unlikely (!rq -> elv .icq ))
@@ -6893,53 +6944,9 @@ static struct bfq_queue *bfq_init_rq(struct request *rq)
6893
6944
return RQ_BFQQ (rq );
6894
6945
6895
6946
bic = icq_to_bic (rq -> elv .icq );
6896
-
6897
6947
bfq_check_ioprio_change (bic , bio );
6898
-
6899
6948
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 );
6943
6950
6944
6951
bfqq_request_allocated (bfqq );
6945
6952
bfqq -> ref ++ ;
0 commit comments