ide: fix TRIM with empty range entry
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 14 Jan 2013 15:26:56 +0000 (16:26 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Tue, 15 Jan 2013 09:03:48 +0000 (10:03 +0100)
ATA-ACS-3 says "If the two byte range length is zero, then the LBA
Range Entry shall be discarded as padding."  iovecs are used as if
they are linearized, so it is incorrect to discard the rest of
this iovec.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
hw/ide/core.c

index 6f1938a..cb77dfc 100644 (file)
@@ -374,7 +374,7 @@ BlockDriverAIOCB *ide_issue_trim(BlockDriverState *bs,
             uint16_t count = entry >> 48;
 
             if (count == 0) {
-                break;
+                continue;
             }
 
             ret = bdrv_discard(bs, sector, count);