[PATCH 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

From: Sitsofe Wheeler
Date: Thu Jul 24 2014 - 03:58:24 EST


Some block devices (such as Hyper-V passthrough SSDs) support logical
block provisioning (e.g. via UNMAP) but don't set lbpme thus disabling
discard. If the try_lbp quirk is in use skip lbpme checks that lead up
to the logical block provisioning tests.

Signed-off-by: Sitsofe Wheeler <sitsofe@xxxxxxxxx>
---
drivers/scsi/sd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 8249e51..8bf34bc 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2559,7 +2559,7 @@ static void sd_read_block_limits(struct scsi_disk *sdkp)

sdkp->max_ws_blocks = (u32)get_unaligned_be64(&buffer[36]);

- if (!sdkp->lbpme)
+ if (!sdkp->lbpme && !sdkp->device->try_lbp)
goto out;

lba_count = get_unaligned_be32(&buffer[20]);
@@ -2633,7 +2633,7 @@ static void sd_read_block_provisioning(struct scsi_disk *sdkp)
unsigned char *buffer;
const int vpd_len = 8;

- if (sdkp->lbpme == 0)
+ if (sdkp->lbpme == 0 && sdkp->device->test_lbp == 0)
return;

buffer = kmalloc(vpd_len, GFP_KERNEL);
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/