diff options
author | Fam Zheng <famz@redhat.com> | 2014-06-17 14:32:06 +0800 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2014-06-27 18:20:32 +0200 |
commit | bf4bd461b43d90c5af30f61f740c1bb675849ab9 (patch) | |
tree | 3ac4398bd9dc4ff518e752ae3f666fb87d9bf880 /hw/block | |
parent | 13344f3a17e0a785c0eb8e36f69518f21aa8a91a (diff) |
virtio-blk: Make request completion function virtual
virtio_blk_req_complete will call VirtIOBlock.complete_request() to push
data and notify guest. No functional change.
Later, this will allow dataplane to provide it's own (vring_) version.
Signed-off-by: Fam Zheng <famz@redhat.com>
Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/block')
-rw-r--r-- | hw/block/virtio-blk.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 4b1aeab525..9975ad0324 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -44,7 +44,8 @@ static void virtio_blk_free_request(VirtIOBlockReq *req) } } -static void virtio_blk_req_complete(VirtIOBlockReq *req, int status) +static void virtio_blk_complete_request(VirtIOBlockReq *req, + unsigned char status) { VirtIOBlock *s = req->dev; VirtIODevice *vdev = VIRTIO_DEVICE(s); @@ -56,6 +57,11 @@ static void virtio_blk_req_complete(VirtIOBlockReq *req, int status) virtio_notify(vdev, s->vq); } +static void virtio_blk_req_complete(VirtIOBlockReq *req, unsigned char status) +{ + req->dev->complete_request(req, status); +} + static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error, bool is_read) { @@ -740,6 +746,7 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp) s->sector_mask = (s->conf->logical_block_size / BDRV_SECTOR_SIZE) - 1; s->vq = virtio_add_queue(vdev, 128, virtio_blk_handle_output); + s->complete_request = virtio_blk_complete_request; #ifdef CONFIG_VIRTIO_BLK_DATA_PLANE virtio_blk_data_plane_create(vdev, blk, &s->dataplane, &err); if (err != NULL) { |