@@ -242,6 +242,11 @@ struct pd_unit {
242242
243243static struct pd_unit pd [PD_UNITS ];
244244
245+ struct pd_req {
246+ /* for REQ_OP_DRV_IN: */
247+ enum action (* func )(struct pd_unit * disk );
248+ };
249+
245250static char pd_scratch [512 ]; /* scratch block buffer */
246251
247252static char * pd_errs [17 ] = { "ERR" , "INDEX" , "ECC" , "DRQ" , "SEEK" , "WRERR" ,
@@ -502,8 +507,9 @@ static enum action do_pd_io_start(void)
502507
503508static enum action pd_special (void )
504509{
505- enum action (* func )(struct pd_unit * ) = pd_req -> special ;
506- return func (pd_current );
510+ struct pd_req * req = blk_mq_rq_to_pdu (pd_req );
511+
512+ return req -> func (pd_current );
507513}
508514
509515static int pd_next_buf (void )
@@ -767,12 +773,14 @@ static int pd_special_command(struct pd_unit *disk,
767773 enum action (* func )(struct pd_unit * disk ))
768774{
769775 struct request * rq ;
776+ struct pd_req * req ;
770777
771778 rq = blk_get_request (disk -> gd -> queue , REQ_OP_DRV_IN , 0 );
772779 if (IS_ERR (rq ))
773780 return PTR_ERR (rq );
781+ req = blk_mq_rq_to_pdu (rq );
774782
775- rq -> special = func ;
783+ req -> func = func ;
776784 blk_execute_rq (disk -> gd -> queue , disk -> gd , rq , 0 );
777785 blk_put_request (rq );
778786 return 0 ;
@@ -892,9 +900,21 @@ static void pd_probe_drive(struct pd_unit *disk)
892900 disk -> gd = p ;
893901 p -> private_data = disk ;
894902
895- p -> queue = blk_mq_init_sq_queue (& disk -> tag_set , & pd_mq_ops , 2 ,
896- BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_BLOCKING );
903+ memset (& disk -> tag_set , 0 , sizeof (disk -> tag_set ));
904+ disk -> tag_set .ops = & pd_mq_ops ;
905+ disk -> tag_set .cmd_size = sizeof (struct pd_req );
906+ disk -> tag_set .nr_hw_queues = 1 ;
907+ disk -> tag_set .nr_maps = 1 ;
908+ disk -> tag_set .queue_depth = 2 ;
909+ disk -> tag_set .numa_node = NUMA_NO_NODE ;
910+ disk -> tag_set .flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_BLOCKING ;
911+
912+ if (blk_mq_alloc_tag_set (& disk -> tag_set ))
913+ return ;
914+
915+ p -> queue = blk_mq_init_queue (& disk -> tag_set );
897916 if (IS_ERR (p -> queue )) {
917+ blk_mq_free_tag_set (& disk -> tag_set );
898918 p -> queue = NULL ;
899919 return ;
900920 }
0 commit comments