Patchwork [1/2] SCSI emulation: Support unmap via WRITE_SAME_10. It is the same as WRITE_SAME_16 as far as QEMU is concerned

login
register
mail settings
Submitter ronniesahlberg@gmail.com
Date April 19, 2012, 10:41 a.m.
Message ID <1334832077-20132-2-git-send-email-ronniesahlberg@gmail.com>
Download mbox | patch
Permalink /patch/153719/
State New
Headers show

Comments

ronniesahlberg@gmail.com - April 19, 2012, 10:41 a.m.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
---
 hw/scsi-disk.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

Patch

diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 9949786..ccd9291 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -531,7 +531,7 @@  static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
         {
             outbuf[3] = buflen = 8;
             outbuf[4] = 0;
-            outbuf[5] = 0x40; /* write same with unmap supported */
+            outbuf[5] = 0x60; /* write_same 10/16 supported */
             outbuf[6] = 0;
             outbuf[7] = 0;
             break;
@@ -1456,10 +1456,11 @@  static int32_t scsi_send_command(SCSIRequest *req, uint8_t *buf)
             goto illegal_lba;
         }
         break;
+    case WRITE_SAME_10:
     case WRITE_SAME_16:
         len = r->req.cmd.xfer / s->qdev.blocksize;
 
-        DPRINTF("WRITE SAME(16) (sector %" PRId64 ", count %d)\n",
+        DPRINTF("WRITE SAME() (sector %" PRId64 ", count %d)\n",
                 r->req.cmd.lba, len);
 
         if (r->req.cmd.lba > s->qdev.max_lba) {