[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 32/47] virtio-blk: Make request completion function v
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 32/47] virtio-blk: Make request completion function virtual |
Date: |
Fri, 27 Jun 2014 21:08:51 +0200 |
From: Fam Zheng <address@hidden>
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 <address@hidden>
Tested-by: Paolo Bonzini <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
hw/block/virtio-blk.c | 9 ++++++++-
include/hw/virtio/virtio-blk.h | 3 +++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 4b1aeab..9975ad0 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) {
diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h
index 2571e96..0398f4c 100644
--- a/include/hw/virtio/virtio-blk.h
+++ b/include/hw/virtio/virtio-blk.h
@@ -117,6 +117,7 @@ struct VirtIOBlkConf
struct VirtIOBlockDataPlane;
+struct VirtIOBlockReq;
typedef struct VirtIOBlock {
VirtIODevice parent_obj;
BlockDriverState *bs;
@@ -128,6 +129,8 @@ typedef struct VirtIOBlock {
unsigned short sector_mask;
bool original_wce;
VMChangeStateEntry *change;
+ /* Function to push to vq and notify guest */
+ void (*complete_request)(struct VirtIOBlockReq *req, unsigned char status);
#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
Notifier migration_state_notifier;
struct VirtIOBlockDataPlane *dataplane;
--
1.8.3.1
- [Qemu-devel] [PULL 15/47] block: Remove a special case for protocols, (continued)
- [Qemu-devel] [PULL 15/47] block: Remove a special case for protocols, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 19/47] quorum: Add the rewrite-corrupted parameter to quorum, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 20/47] block: Add node-name argument to drive-mirror, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 22/47] virtio-blk: Convert VirtIOBlockReq.elem to pointer, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 23/47] virtio-blk: Drop bounce buffer from dataplane code, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 24/47] virtio-blk: Drop VirtIOBlockRequest.read, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 25/47] virtio-blk: Replace VirtIOBlockRequest with VirtIOBlockReq, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 26/47] virtio-blk: Use VirtIOBlockReq.in to drop VirtIOBlockReq.inhdr, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 30/47] block: make bdrv_query_stats() static, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 31/47] block: acquire AioContext in qmp_query_blockstats(), Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 32/47] virtio-blk: Make request completion function virtual,
Kevin Wolf <=
- [Qemu-devel] [PULL 34/47] virtio-blk: Schedule BH in the right context, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 33/47] virtio-blk: Export request handling functions to dataplane, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 40/47] qemu-iotests: Add TestRepairQuorum to 041 to test drive-mirror node-name mode., Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 41/47] block.c: Don't return success for bdrv_append_temp_snapshot() failure, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 42/47] iotests: Allow out-of-tree run, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 43/47] configure: Enable out-of-tree iotests, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 45/47] iotests: Use $PYTHON for Python scripts, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 44/47] iotests: Source common.env, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 47/47] iotests: Fix 083 for out-of-tree builds, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 46/47] iotests: Drop Python version from 065's Shebang, Kevin Wolf, 2014/06/27