Blame SOURCES/kvm-scsi-Advertise-limits-by-blocksize-not-512.patch

34b321
From c8644154fb4b460f00c9d24ed9090edc40fef067 Mon Sep 17 00:00:00 2001
34b321
From: Fam Zheng <famz@redhat.com>
34b321
Date: Mon, 11 Jul 2016 05:33:39 +0200
34b321
Subject: [PATCH 6/7] scsi: Advertise limits by blocksize, not 512
34b321
34b321
RH-Author: Fam Zheng <famz@redhat.com>
34b321
Message-id: <1468215219-30793-7-git-send-email-famz@redhat.com>
34b321
Patchwork-id: 71110
34b321
O-Subject: [RHEL-7.3 qemu-kvm PATCH 6/6] scsi: Advertise limits by blocksize, not 512
34b321
Bugzilla: 1318199
34b321
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
34b321
RH-Acked-by: John Snow <jsnow@redhat.com>
34b321
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
34b321
34b321
From: Eric Blake <eblake@redhat.com>
34b321
34b321
s->blocksize may be larger than 512, in which case our
34b321
tweaks to max_xfer_len and opt_xfer_len must be scaled
34b321
appropriately.
34b321
34b321
CC: qemu-stable@nongnu.org
34b321
Reported-by: Fam Zheng <famz@redhat.com>
34b321
Signed-off-by: Eric Blake <eblake@redhat.com>
34b321
Reviewed-by: Fam Zheng <famz@redhat.com>
34b321
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
34b321
(cherry picked from commit efaf4781a995aacd22b1dd521b14e4644bafae14)
34b321
34b321
 Conflicts:
34b321
	hw/scsi/scsi-generic.c
34b321
Downstream uses bdrv_get_max_transfer_length().
34b321
34b321
Signed-off-by: Fam Zheng <famz@redhat.com>
34b321
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
34b321
---
34b321
 hw/scsi/scsi-generic.c | 3 ++-
34b321
 1 file changed, 2 insertions(+), 1 deletion(-)
34b321
34b321
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
34b321
index 6b0c1fe..ced92f7 100644
34b321
--- a/hw/scsi/scsi-generic.c
34b321
+++ b/hw/scsi/scsi-generic.c
34b321
@@ -210,7 +210,8 @@ static void scsi_read_complete(void * opaque, int ret)
34b321
         } else if (s->type == TYPE_DISK &&
34b321
             r->req.cmd.buf[0] == INQUIRY &&
34b321
             r->req.cmd.buf[2] == 0xb0) {
34b321
-            uint32_t max_xfer_len = bdrv_get_max_transfer_length(s->conf.bs);
34b321
+            uint32_t max_xfer_len = bdrv_get_max_transfer_length(s->conf.bs) /
34b321
+                (s->blocksize / BDRV_SECTOR_SIZE);
34b321
             if (max_xfer_len) {
34b321
                 stl_be_p(&r->buf[8], max_xfer_len);
34b321
                 /* Also take care of the opt xfer len. */
34b321
-- 
34b321
1.8.3.1
34b321