On Fri, Jun 09, 2017 at 10:41:13AM +0100, Stefan Hajnoczi wrote:
On Fri, Jun 09, 2017 at 02:22:55AM +0300, Manos Pitsidianakis wrote:
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 0b48b64..1a74339 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -416,16 +416,16 @@ static void ide_issue_trim_cb(void *opaque, int ret)
                 /* 6-byte LBA + 2-byte range per entry */
                 uint64_t entry = le64_to_cpu(buffer[i]);
                 uint64_t sector = entry & 0x0000ffffffffffffULL;
-                uint16_t count = entry >> 48;
+                uint16_t bytes = entry >> 48;

-                if (count == 0) {
+                if (bytes == 0) {
                     continue;
                 }

                 /* Got an entry! Submit and exit.  */
                 iocb->aiocb = blk_aio_pdiscard(iocb->blk,
                                                sector << BDRV_SECTOR_BITS,
-                                               count << BDRV_SECTOR_BITS,
+                                               bytes << BDRV_SECTOR_BITS,
                                                ide_issue_trim_cb, opaque);
                 return;
             }

This change looks suspicious:

 bytes << BDRV_SECTOR_BITS

Therefore 'bytes' is actually in units of sectors!

Please drop this hunk.


:) Rookie mistake, thanks. (At some other places there's count >> BDRV_SECTOR_BITS, hope this change makes it clear) Will send a v3.

Attachment: signature.asc
Description: PGP signature

Reply via email to