aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/virtio_blk.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-03-14 12:43:15 -0400
committerJens Axboe <axboe@fb.com>2014-03-14 12:43:15 -0400
commit95363efde193079541cb379eb47140e9c4d355d5 (patch)
treeda7417035ca5f25d6818430feaa54cb09a2ba86d /drivers/block/virtio_blk.c
parent89f8b33ca1ea881d1d84542282cb85d07d02e78d (diff)
blk-mq: allow blk_mq_init_commands() to return failure
If drivers do dynamic allocation in the hardware command init path, then we need to be able to handle and return failures. And if they do allocations or mappings in the init command path, then we need a cleanup function to free up that space at exit time. So add blk_mq_free_commands() as the cleanup function. This is required for the mtip32xx driver conversion to blk-mq. Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block/virtio_blk.c')
-rw-r--r--drivers/block/virtio_blk.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index b1cb3f4c4db4..0eace43cea11 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -490,13 +490,14 @@ static struct blk_mq_reg virtio_mq_reg = {
490 .flags = BLK_MQ_F_SHOULD_MERGE, 490 .flags = BLK_MQ_F_SHOULD_MERGE,
491}; 491};
492 492
493static void virtblk_init_vbr(void *data, struct blk_mq_hw_ctx *hctx, 493static int virtblk_init_vbr(void *data, struct blk_mq_hw_ctx *hctx,
494 struct request *rq, unsigned int nr) 494 struct request *rq, unsigned int nr)
495{ 495{
496 struct virtio_blk *vblk = data; 496 struct virtio_blk *vblk = data;
497 struct virtblk_req *vbr = rq->special; 497 struct virtblk_req *vbr = rq->special;
498 498
499 sg_init_table(vbr->sg, vblk->sg_elems); 499 sg_init_table(vbr->sg, vblk->sg_elems);
500 return 0;
500} 501}
501 502
502static int virtblk_probe(struct virtio_device *vdev) 503static int virtblk_probe(struct virtio_device *vdev)