diff options
author | Christoph Hellwig <hch@lst.de> | 2017-05-01 12:19:08 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-05-02 09:52:08 -0400 |
commit | d6296d39e90c9075bc2fc15f1e86dac44930d4b5 (patch) | |
tree | 46c56a31e8b72182c4f9f5d7937f790e9a111f68 /drivers/block | |
parent | a800ce8ba53da88571872cbccb0e2fff8e374752 (diff) |
blk-mq: update ->init_request and ->exit_request prototypes
Remove the request_idx parameter, which can't be used safely now that we
support I/O schedulers with blk-mq. Except for a superflous check in
mtip32xx it was unused anyway.
Also pass the tag_set instead of just the driver data - this allows drivers
to avoid some code duplication in a follow on cleanup.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/loop.c | 5 | ||||
-rw-r--r-- | drivers/block/mtip32xx/mtip32xx.c | 20 | ||||
-rw-r--r-- | drivers/block/nbd.c | 7 | ||||
-rw-r--r-- | drivers/block/rbd.c | 5 | ||||
-rw-r--r-- | drivers/block/virtio_blk.c | 7 |
5 files changed, 16 insertions, 28 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 994403efee19..28d932906f24 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -1697,9 +1697,8 @@ static void loop_queue_work(struct kthread_work *work) | |||
1697 | loop_handle_cmd(cmd); | 1697 | loop_handle_cmd(cmd); |
1698 | } | 1698 | } |
1699 | 1699 | ||
1700 | static int loop_init_request(void *data, struct request *rq, | 1700 | static int loop_init_request(struct blk_mq_tag_set *set, struct request *rq, |
1701 | unsigned int hctx_idx, unsigned int request_idx, | 1701 | unsigned int hctx_idx, unsigned int numa_node) |
1702 | unsigned int numa_node) | ||
1703 | { | 1702 | { |
1704 | struct loop_cmd *cmd = blk_mq_rq_to_pdu(rq); | 1703 | struct loop_cmd *cmd = blk_mq_rq_to_pdu(rq); |
1705 | 1704 | ||
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 9108be601a64..96fe6500e941 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -3818,10 +3818,10 @@ static int mtip_queue_rq(struct blk_mq_hw_ctx *hctx, | |||
3818 | return BLK_MQ_RQ_QUEUE_ERROR; | 3818 | return BLK_MQ_RQ_QUEUE_ERROR; |
3819 | } | 3819 | } |
3820 | 3820 | ||
3821 | static void mtip_free_cmd(void *data, struct request *rq, | 3821 | static void mtip_free_cmd(struct blk_mq_tag_set *set, struct request *rq, |
3822 | unsigned int hctx_idx, unsigned int request_idx) | 3822 | unsigned int hctx_idx) |
3823 | { | 3823 | { |
3824 | struct driver_data *dd = data; | 3824 | struct driver_data *dd = set->driver_data; |
3825 | struct mtip_cmd *cmd = blk_mq_rq_to_pdu(rq); | 3825 | struct mtip_cmd *cmd = blk_mq_rq_to_pdu(rq); |
3826 | 3826 | ||
3827 | if (!cmd->command) | 3827 | if (!cmd->command) |
@@ -3831,20 +3831,12 @@ static void mtip_free_cmd(void *data, struct request *rq, | |||
3831 | cmd->command, cmd->command_dma); | 3831 | cmd->command, cmd->command_dma); |
3832 | } | 3832 | } |
3833 | 3833 | ||
3834 | static int mtip_init_cmd(void *data, struct request *rq, unsigned int hctx_idx, | 3834 | static int mtip_init_cmd(struct blk_mq_tag_set *set, struct request *rq, |
3835 | unsigned int request_idx, unsigned int numa_node) | 3835 | unsigned int hctx_idx, unsigned int numa_node) |
3836 | { | 3836 | { |
3837 | struct driver_data *dd = data; | 3837 | struct driver_data *dd = set->driver_data; |
3838 | struct mtip_cmd *cmd = blk_mq_rq_to_pdu(rq); | 3838 | struct mtip_cmd *cmd = blk_mq_rq_to_pdu(rq); |
3839 | 3839 | ||
3840 | /* | ||
3841 | * For flush requests, request_idx starts at the end of the | ||
3842 | * tag space. Since we don't support FLUSH/FUA, simply return | ||
3843 | * 0 as there's nothing to be done. | ||
3844 | */ | ||
3845 | if (request_idx >= MTIP_MAX_COMMAND_SLOTS) | ||
3846 | return 0; | ||
3847 | |||
3848 | cmd->command = dmam_alloc_coherent(&dd->pdev->dev, CMD_DMA_ALLOC_SZ, | 3840 | cmd->command = dmam_alloc_coherent(&dd->pdev->dev, CMD_DMA_ALLOC_SZ, |
3849 | &cmd->command_dma, GFP_KERNEL); | 3841 | &cmd->command_dma, GFP_KERNEL); |
3850 | if (!cmd->command) | 3842 | if (!cmd->command) |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index ac376b9b852d..6b98ec2a3824 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -1396,12 +1396,11 @@ static void nbd_dbg_close(void) | |||
1396 | 1396 | ||
1397 | #endif | 1397 | #endif |
1398 | 1398 | ||
1399 | static int nbd_init_request(void *data, struct request *rq, | 1399 | static int nbd_init_request(struct blk_mq_tag_set *set, struct request *rq, |
1400 | unsigned int hctx_idx, unsigned int request_idx, | 1400 | unsigned int hctx_idx, unsigned int numa_node) |
1401 | unsigned int numa_node) | ||
1402 | { | 1401 | { |
1403 | struct nbd_cmd *cmd = blk_mq_rq_to_pdu(rq); | 1402 | struct nbd_cmd *cmd = blk_mq_rq_to_pdu(rq); |
1404 | cmd->nbd = data; | 1403 | cmd->nbd = set->driver_data; |
1405 | return 0; | 1404 | return 0; |
1406 | } | 1405 | } |
1407 | 1406 | ||
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 089ac4179919..3670e8dd03fe 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -4307,9 +4307,8 @@ out: | |||
4307 | return ret; | 4307 | return ret; |
4308 | } | 4308 | } |
4309 | 4309 | ||
4310 | static int rbd_init_request(void *data, struct request *rq, | 4310 | static int rbd_init_request(struct blk_mq_tag_set *set, struct request *rq, |
4311 | unsigned int hctx_idx, unsigned int request_idx, | 4311 | unsigned int hctx_idx, unsigned int numa_node) |
4312 | unsigned int numa_node) | ||
4313 | { | 4312 | { |
4314 | struct work_struct *work = blk_mq_rq_to_pdu(rq); | 4313 | struct work_struct *work = blk_mq_rq_to_pdu(rq); |
4315 | 4314 | ||
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index f94614257462..94173de1efaa 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -573,11 +573,10 @@ static const struct device_attribute dev_attr_cache_type_rw = | |||
573 | __ATTR(cache_type, S_IRUGO|S_IWUSR, | 573 | __ATTR(cache_type, S_IRUGO|S_IWUSR, |
574 | virtblk_cache_type_show, virtblk_cache_type_store); | 574 | virtblk_cache_type_show, virtblk_cache_type_store); |
575 | 575 | ||
576 | static int virtblk_init_request(void *data, struct request *rq, | 576 | static int virtblk_init_request(struct blk_mq_tag_set *set, struct request *rq, |
577 | unsigned int hctx_idx, unsigned int request_idx, | 577 | unsigned int hctx_idx, unsigned int numa_node) |
578 | unsigned int numa_node) | ||
579 | { | 578 | { |
580 | struct virtio_blk *vblk = data; | 579 | struct virtio_blk *vblk = set->driver_data; |
581 | struct virtblk_req *vbr = blk_mq_rq_to_pdu(rq); | 580 | struct virtblk_req *vbr = blk_mq_rq_to_pdu(rq); |
582 | 581 | ||
583 | #ifdef CONFIG_VIRTIO_BLK_SCSI | 582 | #ifdef CONFIG_VIRTIO_BLK_SCSI |