Patchwork [24/30] scsi-disk: restruct emulation: SYNCHRONIZE_CACHE

login
register
mail settings
Submitter Gerd Hoffmann
Date Nov. 26, 2009, 2:34 p.m.
Message ID <1259246056-5389-25-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/39553/
State New
Headers show

Comments

Gerd Hoffmann - Nov. 26, 2009, 2:34 p.m.
Move SYNCHRONIZE_CACHE emulation from scsi_send_command() to
scsi_disk_emulate_command().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/scsi-disk.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

Patch

diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 4f56a22..865c5db 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -705,6 +705,9 @@  static int scsi_disk_emulate_command(SCSIRequest *req, uint8_t *outbuf)
         outbuf[7] = 0;
         buflen = 8;
 	break;
+    case SYNCHRONIZE_CACHE:
+        bdrv_flush(bdrv);
+        break;
     default:
         goto illegal_request;
     }
@@ -819,6 +822,7 @@  static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
     case START_STOP:
     case ALLOW_MEDIUM_REMOVAL:
     case READ_CAPACITY:
+    case SYNCHRONIZE_CACHE:
         rc = scsi_disk_emulate_command(&r->req, outbuf);
         if (rc > 0) {
             r->iov.iov_len = rc;
@@ -847,10 +851,6 @@  static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
         r->sector_count = len * s->cluster_size;
         is_write = 1;
         break;
-    case SYNCHRONIZE_CACHE:
-        DPRINTF("Synchronise cache (sector %" PRId64 ", count %d)\n", lba, len);
-        bdrv_flush(s->qdev.dinfo->bdrv);
-        break;
     case READ_TOC:
         {
             int start_track, format, msf, toclen;