Patchwork [22/35] scsi-disk: fix retrying a flush

login
register
mail settings
Submitter Paolo Bonzini
Date Oct. 13, 2011, 11:03 a.m.
Message ID <1318503845-11473-23-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/119425/
State New
Headers show

Comments

Paolo Bonzini - Oct. 13, 2011, 11:03 a.m.
Flush does not go anymore through scsi_disk_emulate_command.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi-disk.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

Patch

diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 3f54891..860a3bf 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -81,7 +81,7 @@  struct SCSIDiskState
 };
 
 static int scsi_handle_rw_error(SCSIDiskReq *r, int error, int type);
-static int scsi_disk_emulate_command(SCSIDiskReq *r);
+static int32_t scsi_send_command(SCSIRequest *req, uint8_t *buf);
 
 static void scsi_free_request(SCSIRequest *req)
 {
@@ -336,7 +336,6 @@  static void scsi_dma_restart_bh(void *opaque)
         r = DO_UPCAST(SCSIDiskReq, req, req);
         if (r->status & SCSI_REQ_STATUS_RETRY) {
             int status = r->status;
-            int ret;
 
             r->status &=
                 ~(SCSI_REQ_STATUS_RETRY | SCSI_REQ_STATUS_RETRY_TYPE_MASK);
@@ -349,10 +348,8 @@  static void scsi_dma_restart_bh(void *opaque)
                 scsi_write_data(&r->req);
                 break;
             case SCSI_REQ_STATUS_RETRY_FLUSH:
-                ret = scsi_disk_emulate_command(r);
-                if (ret == 0) {
-                    scsi_req_complete(&r->req, GOOD);
-                }
+                scsi_send_command(&r->req, r->req.cmd.buf);
+                break;
             }
             /* This reference was left in by scsi_handle_rw_error.  */
             scsi_req_unref(&r->req);