Skip to contentSkip to conversation

scsi-disk: provide "max write same length" for block limits VPD page

PATCH In review Ming Lei 2 participants 2 messages Dec 5, 2014

lore
Share & tools
lore

Ming Lei

author
#0 lore raw

PATCH 1/1 scsi-disk: provide "max write same length" for block limits VPD page

Since QEMU claims to support UNMAP, WRITE SAME and WRITE SAME 16 in the LBP VPD page, it is better to provide "max write same length" in response for block limits VPD page because:

- T10 SBC-3 doesn't describe priority explicitly when all three are enabled
- host driver may prefer WRITE/WRITE 16, then try to parse "max write same length"

---
 hw/scsi/scsi-disk.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
hw/scsi/scsi-disk.c +14 -0
index 2f75d7d..b15bf4f 100644
@@ -674,6 +674,20 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
             outbuf[29] = (unmap_sectors >> 16) & 0xff;
             outbuf[30] = (unmap_sectors >> 8) & 0xff;
             outbuf[31] = unmap_sectors & 0xff;
+
+            /*
+             * maximum write same length, just borrow max unmap
+             * count because write same command need to support
+             * unmap
+             */
+            outbuf[36] = 0;
+            outbuf[37] = 0;
+            outbuf[38] = 0;
+            outbuf[39] = 0;
+            outbuf[40] = (max_unmap_sectors >> 24) & 0xff;
+            outbuf[41] = (max_unmap_sectors >> 16) & 0xff;
+            outbuf[42] = (max_unmap_sectors >> 8) & 0xff;
+            outbuf[43] = max_unmap_sectors & 0xff;
             break;
         }
         case 0xb2: /* thin provisioning */
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 30 lines · Ming Lei

Since QEMU claims to support UNMAP, WRITE SAME and WRITE SAME 16 in the LBP VPD page, it is better to provide "max write same length" in response for block limits VPD page because:

- T10 SBC-3 doesn't describe priority explicitly when all three are enabled
- host driver may prefer WRITE/WRITE 16, then try to parse "max write same length"

---
 hw/scsi/scsi-disk.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
hw/scsi/scsi-disk.c +7 -0
index 2f75d7d..b15bf4f 100644
@@ -674,6 +674,20 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
             outbuf[29] = (unmap_sectors >> 16) & 0xff;
             outbuf[30] = (unmap_sectors >> 8) & 0xff;
             outbuf[31] = unmap_sectors & 0xff;
+
+            /*
+             * maximum write same length, just borrow max unmap
+             * count because write same command need to support
+             * unmap
+             */
+            outbuf[36] = 0;

hw/scsi/scsi-disk.c static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf) · line 693

Quoted 10 lines
hw/scsi/scsi-disk.c +7 -0
+            outbuf[37] = 0;
+            outbuf[38] = 0;
+            outbuf[39] = 0;
+            outbuf[40] = (max_unmap_sectors >> 24) & 0xff;
+            outbuf[41] = (max_unmap_sectors >> 16) & 0xff;
+            outbuf[42] = (max_unmap_sectors >> 8) & 0xff;
+            outbuf[43] = max_unmap_sectors & 0xff;
             break;
         }
         case 0xb2: /* thin provisioning */

There is support for splitting write_zeroes requests in the block layer, so this is a problem elsewhere in the stack. It could be in QEMU block/ or in Linux. Let's analyze it in the linux-scsi thread.

Paolo