public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: relax PAGE LENGTH check for thin provisioning UNMAP support
@ 2010-05-05 21:50 Mike Snitzer
  2010-05-06  4:28 ` Martin K. Petersen
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Snitzer @ 2010-05-05 21:50 UTC (permalink / raw)
  To: linux-scsi; +Cc: Martin K. Petersen, Christoph Hellwig

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-05-07  4:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-05 21:50 [PATCH] scsi: relax PAGE LENGTH check for thin provisioning UNMAP support Mike Snitzer
2010-05-06  4:28 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox