aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2009-11-27 13:25:39 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-03 11:45:49 -0600
commitf35d68f0e79ed82d1c9a8a78a688d0ead8bf05f2 (patch)
tree859b016f3bfe5ff8a172e679531a31cb2907a8b9 /hw
parentce4b6522f71f6cc5ccdb0d278f94ae1b85ba0959 (diff)
downloadqemu-f35d68f0e79ed82d1c9a8a78a688d0ead8bf05f2.zip
qemu-f35d68f0e79ed82d1c9a8a78a688d0ead8bf05f2.tar.gz
qemu-f35d68f0e79ed82d1c9a8a78a688d0ead8bf05f2.tar.bz2
virtio-blk: Implement rerror option
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/virtio-blk.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index a93d20d..a2f0639 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -98,9 +98,11 @@ static void virtio_blk_req_complete(VirtIOBlockReq *req, int status)
qemu_free(req);
}
-static int virtio_blk_handle_write_error(VirtIOBlockReq *req, int error)
+static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error,
+ int is_read)
{
- BlockInterfaceErrorAction action = drive_get_on_error(req->dev->bs, 0);
+ BlockInterfaceErrorAction action =
+ drive_get_on_error(req->dev->bs, is_read);
VirtIOBlock *s = req->dev;
if (action == BLOCK_ERR_IGNORE)
@@ -122,12 +124,13 @@ static void virtio_blk_rw_complete(void *opaque, int ret)
{
VirtIOBlockReq *req = opaque;
- if (ret && (req->out->type & VIRTIO_BLK_T_OUT)) {
- if (virtio_blk_handle_write_error(req, -ret))
+ if (ret) {
+ int is_read = !(req->out->type & VIRTIO_BLK_T_OUT);
+ if (virtio_blk_handle_rw_error(req, -ret, is_read))
return;
}
- virtio_blk_req_complete(req, ret ? VIRTIO_BLK_S_IOERR : VIRTIO_BLK_S_OK);
+ virtio_blk_req_complete(req, VIRTIO_BLK_S_OK);
}
static void virtio_blk_flush_complete(void *opaque, int ret)