From: Mike Snitzer <snitzer@redhat.com>
To: linux-scsi@vger.kernel.org
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
Christoph Hellwig <hch@infradead.org>
Subject: [PATCH] scsi: relax PAGE LENGTH check for thin provisioning UNMAP support
Date: Wed, 5 May 2010 17:50:03 -0400 [thread overview]
Message-ID: <1273096203-3164-1-git-send-email-snitzer@redhat.com> (raw)
Thin Provisioning fields are assumed available in the BLOCK LIMITS VPD
page if PAGE LENGTH is 0x3c. The BLOCK LIMITS VPD page may be extended
over time. Allow for the possibility that the PAGE LENGTH exceeds 0x3c.
Further details:
Linux SCSI defaults to using WRITE SAME(16) with UNMAP bit set for
discards.
If PAGE LENGTH is 0x3c and both MAXIMUM UNMAP LBA COUNT and MAXIMUM
UNMAP BLOCK DESCRIPTOR COUNT are set (in BLOCK LIMITS VPD page), Linux
SCSI will issue UNMAP instead of using the default (WRITE SAME(16) with
UNMAP bit set).
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
drivers/scsi/sd.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 8b827f3..40ab22e 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1963,7 +1963,7 @@ static void sd_read_block_limits(struct scsi_disk *sdkp)
get_unaligned_be32(&buffer[12]) * sector_sz);
/* Thin provisioning enabled and page length indicates TP support */
- if (sdkp->thin_provisioning && buffer[3] == 0x3c) {
+ if (sdkp->thin_provisioning && buffer[3] >= 0x3c) {
unsigned int lba_count, desc_count, granularity;
lba_count = get_unaligned_be32(&buffer[20]);
--
1.6.6.1
next reply other threads:[~2010-05-05 21:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-05 21:50 Mike Snitzer [this message]
2010-05-06 4:28 ` [PATCH] scsi: relax PAGE LENGTH check for thin provisioning UNMAP support Martin K. Petersen
2010-05-06 11:24 ` Mike Snitzer
2010-05-06 14:27 ` Knight, Frederick
2010-05-07 4:52 ` Martin K. Petersen
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=1273096203-3164-1-git-send-email-snitzer@redhat.com \
--to=snitzer@redhat.com \
--cc=hch@infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/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