mirror of https://github.com/xqemu/xqemu.git
virtio-blk: Implement rerror option
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
ce4b6522f7
commit
f35d68f0e7
|
@ -98,9 +98,11 @@ static void virtio_blk_req_complete(VirtIOBlockReq *req, int status)
|
||||||
qemu_free(req);
|
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;
|
VirtIOBlock *s = req->dev;
|
||||||
|
|
||||||
if (action == BLOCK_ERR_IGNORE)
|
if (action == BLOCK_ERR_IGNORE)
|
||||||
|
@ -122,12 +124,13 @@ static void virtio_blk_rw_complete(void *opaque, int ret)
|
||||||
{
|
{
|
||||||
VirtIOBlockReq *req = opaque;
|
VirtIOBlockReq *req = opaque;
|
||||||
|
|
||||||
if (ret && (req->out->type & VIRTIO_BLK_T_OUT)) {
|
if (ret) {
|
||||||
if (virtio_blk_handle_write_error(req, -ret))
|
int is_read = !(req->out->type & VIRTIO_BLK_T_OUT);
|
||||||
|
if (virtio_blk_handle_rw_error(req, -ret, is_read))
|
||||||
return;
|
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)
|
static void virtio_blk_flush_complete(void *opaque, int ret)
|
||||||
|
|
2
vl.c
2
vl.c
|
@ -2198,7 +2198,7 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque,
|
||||||
|
|
||||||
on_read_error = BLOCK_ERR_REPORT;
|
on_read_error = BLOCK_ERR_REPORT;
|
||||||
if ((buf = qemu_opt_get(opts, "rerror")) != NULL) {
|
if ((buf = qemu_opt_get(opts, "rerror")) != NULL) {
|
||||||
if (type != IF_IDE) {
|
if (type != IF_IDE && type != IF_VIRTIO) {
|
||||||
fprintf(stderr, "rerror is no supported by this format\n");
|
fprintf(stderr, "rerror is no supported by this format\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue