From: Andy Whitcroft <apw@canonical.com>
To: "James E.J. Bottomley" <JBottomley@parallels.com>,
"K. Y. Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>
Cc: Andy Whitcroft <apw@canonical.com>,
Ben Howard <ben.howard@canonical.com>,
linux-scsi@vger.kernel.org, devel@linuxdriverproject.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/4] scsi: add scsi device flag to request VPD pages be used at SPC-2
Date: Fri, 13 Sep 2013 13:58:26 +0100 [thread overview]
Message-ID: <1379077109-29606-2-git-send-email-apw@canonical.com> (raw)
In-Reply-To: <1379077109-29606-1-git-send-email-apw@canonical.com>
Under Hyper-V the disk devices support the trim extensions advertising them
via the appropriate VPD pages, it however reports itself as SPC-2 only.
The relevant pages were added in SPC-3 and later, so we do not even
attempt to see if they are present; the VPD page 0 lists which other
pages are present.
Add a scsi quirk bit to allow those devices to hint we can and should
try these VPD pages.
BugLink: http://bugs.launchpad.net/bugs/1223499
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
drivers/scsi/sd.c | 6 +++++-
include/scsi/scsi_device.h | 1 +
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index b58e8f8..5a8a04d 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2667,8 +2667,12 @@ static int sd_try_extended_inquiry(struct scsi_device *sdp)
* Although VPD inquiries can go to SCSI-2 type devices,
* some USB ones crash on receiving them, and the pages
* we currently ask for are for SPC-3 and beyond
+ * Allow devices to request use of VPD inquiry at SPC-2
+ * as some devices implement these extensions (inc Hyper-V)
*/
- if (sdp->scsi_level > SCSI_SPC_2 && !sdp->skip_vpd_pages)
+ if ((sdp->scsi_level > SCSI_SPC_2 ||
+ (sdp->use_vpd_spc2 && sdp->scsi_level >= SCSI_SPC_2)) &&
+ !sdp->skip_vpd_pages)
return 1;
return 0;
}
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index d65fbec..9b7fdb6 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -149,6 +149,7 @@ struct scsi_device {
unsigned skip_ms_page_8:1; /* do not use MODE SENSE page 0x08 */
unsigned skip_ms_page_3f:1; /* do not use MODE SENSE page 0x3f */
unsigned skip_vpd_pages:1; /* do not read VPD pages */
+ unsigned use_vpd_spc2:1; /* do use VPD pages at SPC-2 */
unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */
unsigned no_start_on_add:1; /* do not issue start on add */
unsigned allow_restart:1; /* issue START_UNIT in error handler */
--
1.8.1.2
next prev parent reply other threads:[~2013-09-13 12:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-13 12:58 [PATCH 0/4] Hyper-V TRIM support Andy Whitcroft
2013-09-13 12:58 ` Andy Whitcroft [this message]
2013-09-13 12:58 ` [PATCH 2/4] scsi: add scsi device flag to request READ CAPACITY (16) be preferred Andy Whitcroft
2013-09-13 12:58 ` [PATCH 3/4] scsi: hyper-v storage -- mark as VPD capable at SPC-2 Andy Whitcroft
2013-09-13 12:58 ` [PATCH 4/4] scsi: hyper-v storage -- mark as preferring READ CAPACITY (16) " Andy Whitcroft
2013-09-13 14:57 ` [PATCH 0/4] Hyper-V TRIM support James Bottomley
2013-09-13 15:40 ` Andy Whitcroft
2013-09-13 15:40 ` Douglas Gilbert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1379077109-29606-2-git-send-email-apw@canonical.com \
--to=apw@canonical.com \
--cc=JBottomley@parallels.com \
--cc=ben.howard@canonical.com \
--cc=devel@linuxdriverproject.org \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).