[PATCH] scsi: relax PAGE LENGTH check for thin provisioning UNMAP support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux