qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 6/8] scsi: Support I/O status


From: Luiz Capitulino
Subject: [Qemu-devel] [PATCH 6/8] scsi: Support I/O status
Date: Tue, 5 Jul 2011 15:17:49 -0300

Signed-off-by: Luiz Capitulino <address@hidden>
---
 hw/scsi-disk.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 66037fd..7002560 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -137,10 +137,12 @@ static void scsi_cancel_io(SCSIRequest *req)
 static void scsi_read_complete(void * opaque, int ret)
 {
     SCSIDiskReq *r = (SCSIDiskReq *)opaque;
+    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
     int n;
 
     r->req.aiocb = NULL;
 
+    bdrv_iostatus_update(s->bs, ret);
     if (ret) {
         if (scsi_handle_rw_error(r, -ret, SCSI_REQ_STATUS_RETRY_READ)) {
             return;
@@ -243,11 +245,13 @@ static int scsi_handle_rw_error(SCSIDiskReq *r, int 
error, int type)
 static void scsi_write_complete(void * opaque, int ret)
 {
     SCSIDiskReq *r = (SCSIDiskReq *)opaque;
+    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
     uint32_t len;
     uint32_t n;
 
     r->req.aiocb = NULL;
 
+    bdrv_iostatus_update(s->bs, ret);
     if (ret) {
         if (scsi_handle_rw_error(r, -ret, SCSI_REQ_STATUS_RETRY_WRITE)) {
             return;
@@ -905,6 +909,7 @@ static int scsi_disk_emulate_command(SCSIDiskReq *r, 
uint8_t *outbuf)
        break;
     case SYNCHRONIZE_CACHE:
         ret = bdrv_flush(s->bs);
+        bdrv_iostatus_update(s->bs, ret);
         if (ret < 0) {
             if (scsi_handle_rw_error(r, -ret, SCSI_REQ_STATUS_RETRY_FLUSH)) {
                 return -1;
@@ -1226,6 +1231,7 @@ static int scsi_initfn(SCSIDevice *dev, SCSIDriveKind 
kind)
 
     s->qdev.type = TYPE_DISK;
     qemu_add_vm_change_state_handler(scsi_dma_restart_cb, s);
+    bdrv_enable_iostatus(s->bs);
     bdrv_set_removable(s->bs, kind == SCSI_CD);
     add_boot_device_path(s->qdev.conf.bootindex, &dev->qdev, ",0");
     return 0;
-- 
1.7.6.131.g99019




reply via email to

[Prev in Thread] Current Thread [Next in Thread]