@@ -568,13 +568,13 @@ static void blk_mq_requeue_work(struct work_struct *work)
568568
569569 rq -> rq_flags &= ~RQF_SOFTBARRIER ;
570570 list_del_init (& rq -> queuelist );
571- blk_mq_sched_insert_request (rq , true, false, false);
571+ blk_mq_sched_insert_request (rq , true, false, false, true );
572572 }
573573
574574 while (!list_empty (& rq_list )) {
575575 rq = list_entry (rq_list .next , struct request , queuelist );
576576 list_del_init (& rq -> queuelist );
577- blk_mq_sched_insert_request (rq , false, false, false);
577+ blk_mq_sched_insert_request (rq , false, false, false, true );
578578 }
579579
580580 blk_mq_run_hw_queues (q , false);
@@ -847,12 +847,11 @@ static inline unsigned int queued_to_index(unsigned int queued)
847847 return min (BLK_MQ_MAX_DISPATCH_ORDER - 1 , ilog2 (queued ) + 1 );
848848}
849849
850- static bool blk_mq_get_driver_tag (struct request * rq ,
851- struct blk_mq_hw_ctx * * hctx , bool wait )
850+ bool blk_mq_get_driver_tag (struct request * rq , struct blk_mq_hw_ctx * * hctx ,
851+ bool wait )
852852{
853853 struct blk_mq_alloc_data data = {
854854 .q = rq -> q ,
855- .ctx = rq -> mq_ctx ,
856855 .hctx = blk_mq_map_queue (rq -> q , rq -> mq_ctx -> cpu ),
857856 .flags = wait ? 0 : BLK_MQ_REQ_NOWAIT ,
858857 };
@@ -1395,7 +1394,7 @@ static void blk_mq_try_issue_directly(struct request *rq, blk_qc_t *cookie)
13951394 }
13961395
13971396insert :
1398- blk_mq_sched_insert_request (rq , false, true, true);
1397+ blk_mq_sched_insert_request (rq , false, true, true, false );
13991398}
14001399
14011400/*
@@ -1446,10 +1445,12 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio)
14461445 cookie = request_to_qc_t (data .hctx , rq );
14471446
14481447 if (unlikely (is_flush_fua )) {
1448+ blk_mq_put_ctx (data .ctx );
14491449 blk_mq_bio_to_request (rq , bio );
14501450 blk_mq_get_driver_tag (rq , NULL , true);
14511451 blk_insert_flush (rq );
1452- goto run_queue ;
1452+ blk_mq_run_hw_queue (data .hctx , true);
1453+ goto done ;
14531454 }
14541455
14551456 plug = current -> plug ;
@@ -1502,7 +1503,7 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio)
15021503 blk_mq_put_ctx (data .ctx );
15031504 blk_mq_bio_to_request (rq , bio );
15041505 blk_mq_sched_insert_request (rq , false, true,
1505- !is_sync || is_flush_fua );
1506+ !is_sync || is_flush_fua , true );
15061507 goto done ;
15071508 }
15081509 if (!blk_mq_merge_queue_io (data .hctx , data .ctx , rq , bio )) {
@@ -1512,7 +1513,6 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio)
15121513 * latter allows for merging opportunities and more efficient
15131514 * dispatching.
15141515 */
1515- run_queue :
15161516 blk_mq_run_hw_queue (data .hctx , !is_sync || is_flush_fua );
15171517 }
15181518 blk_mq_put_ctx (data .ctx );
@@ -1568,10 +1568,12 @@ static blk_qc_t blk_sq_make_request(struct request_queue *q, struct bio *bio)
15681568 cookie = request_to_qc_t (data .hctx , rq );
15691569
15701570 if (unlikely (is_flush_fua )) {
1571+ blk_mq_put_ctx (data .ctx );
15711572 blk_mq_bio_to_request (rq , bio );
15721573 blk_mq_get_driver_tag (rq , NULL , true);
15731574 blk_insert_flush (rq );
1574- goto run_queue ;
1575+ blk_mq_run_hw_queue (data .hctx , true);
1576+ goto done ;
15751577 }
15761578
15771579 /*
@@ -1612,7 +1614,7 @@ static blk_qc_t blk_sq_make_request(struct request_queue *q, struct bio *bio)
16121614 blk_mq_put_ctx (data .ctx );
16131615 blk_mq_bio_to_request (rq , bio );
16141616 blk_mq_sched_insert_request (rq , false, true,
1615- !is_sync || is_flush_fua );
1617+ !is_sync || is_flush_fua , true );
16161618 goto done ;
16171619 }
16181620 if (!blk_mq_merge_queue_io (data .hctx , data .ctx , rq , bio )) {
@@ -1622,7 +1624,6 @@ static blk_qc_t blk_sq_make_request(struct request_queue *q, struct bio *bio)
16221624 * latter allows for merging opportunities and more efficient
16231625 * dispatching.
16241626 */
1625- run_queue :
16261627 blk_mq_run_hw_queue (data .hctx , !is_sync || is_flush_fua );
16271628 }
16281629
0 commit comments