[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH v3 07/22] scsi: Advertise limits by blocksize, not
From: |
Eric Blake |
Subject: |
[Qemu-stable] [PATCH v3 07/22] scsi: Advertise limits by blocksize, not 512 |
Date: |
Thu, 23 Jun 2016 16:37:11 -0600 |
s->blocksize may be larger than 512, in which case our
tweaks to max_xfer_len and opt_xfer_len must be scaled
appropriately.
Reported-by: Fam Zheng <address@hidden>
Signed-off-by: Eric Blake <address@hidden>
CC: address@hidden
---
v3: new patch
---
hw/scsi/scsi-generic.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index 6a2d89a..75e227d 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -225,7 +225,8 @@ static void scsi_read_complete(void * opaque, int ret)
if (s->type == TYPE_DISK &&
r->req.cmd.buf[0] == INQUIRY &&
r->req.cmd.buf[2] == 0xb0) {
- uint32_t max_xfer_len = blk_get_max_transfer_length(s->conf.blk);
+ uint32_t max_xfer_len = blk_get_max_transfer_length(s->conf.blk) /
+ (s->blocksize / BDRV_SECTOR_SIZE);
if (max_xfer_len) {
stl_be_p(&r->buf[8], max_xfer_len);
/* Also take care of the opt xfer len. */
--
2.5.5
- [Qemu-stable] [PATCH v3 07/22] scsi: Advertise limits by blocksize, not 512,
Eric Blake <=