Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pd: replace ->special use with private data in the request

Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Christoph Hellwig and committed by
Jens Axboe
289d088b 61e7712e

+25 -5
+25 -5
drivers/block/paride/pd.c
··· 242 242 243 243 static struct pd_unit pd[PD_UNITS]; 244 244 245 + struct pd_req { 246 + /* for REQ_OP_DRV_IN: */ 247 + enum action (*func)(struct pd_unit *disk); 248 + }; 249 + 245 250 static char pd_scratch[512]; /* scratch block buffer */ 246 251 247 252 static char *pd_errs[17] = { "ERR", "INDEX", "ECC", "DRQ", "SEEK", "WRERR", ··· 507 502 508 503 static enum action pd_special(void) 509 504 { 510 - enum action (*func)(struct pd_unit *) = pd_req->special; 511 - return func(pd_current); 505 + struct pd_req *req = blk_mq_rq_to_pdu(pd_req); 506 + 507 + return req->func(pd_current); 512 508 } 513 509 514 510 static int pd_next_buf(void) ··· 773 767 enum action (*func)(struct pd_unit *disk)) 774 768 { 775 769 struct request *rq; 770 + struct pd_req *req; 776 771 777 772 rq = blk_get_request(disk->gd->queue, REQ_OP_DRV_IN, 0); 778 773 if (IS_ERR(rq)) 779 774 return PTR_ERR(rq); 775 + req = blk_mq_rq_to_pdu(rq); 780 776 781 - rq->special = func; 777 + req->func = func; 782 778 blk_execute_rq(disk->gd->queue, disk->gd, rq, 0); 783 779 blk_put_request(rq); 784 780 return 0; ··· 900 892 disk->gd = p; 901 893 p->private_data = disk; 902 894 903 - p->queue = blk_mq_init_sq_queue(&disk->tag_set, &pd_mq_ops, 2, 904 - BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_BLOCKING); 895 + memset(&disk->tag_set, 0, sizeof(disk->tag_set)); 896 + disk->tag_set.ops = &pd_mq_ops; 897 + disk->tag_set.cmd_size = sizeof(struct pd_req); 898 + disk->tag_set.nr_hw_queues = 1; 899 + disk->tag_set.nr_maps = 1; 900 + disk->tag_set.queue_depth = 2; 901 + disk->tag_set.numa_node = NUMA_NO_NODE; 902 + disk->tag_set.flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_BLOCKING; 903 + 904 + if (blk_mq_alloc_tag_set(&disk->tag_set)) 905 + return; 906 + 907 + p->queue = blk_mq_init_queue(&disk->tag_set); 905 908 if (IS_ERR(p->queue)) { 909 + blk_mq_free_tag_set(&disk->tag_set); 906 910 p->queue = NULL; 907 911 return; 908 912 }