[PATCH 3.16 108/217] sd: Fix discard granularity when LBPRZ=1
From: Ben Hutchings
Date: Tue Apr 26 2016 - 19:13:53 EST
3.16.35-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Martin K. Petersen" <martin.petersen@xxxxxxxxxx>
commit f4327a95dd080ed6aecb185478a88ce1ee4fa3c4 upstream.
Commit 397737223c59 ("sd: Make discard granularity match logical block
size when LBPRZ=1") accidentally set the granularity to one byte instead
of one logical block on devices that provide deterministic zeroes after
UNMAP.
Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
Reported-by: Mike Snitzer <snitzer@xxxxxxxxxx>
Reviewed-by: Ewan Milne <emilne@xxxxxxxxxx>
Reviewed-by: Bart Van Assche <bart.vanassche@xxxxxxxxxxx>
Fixes: 397737223c59e89dca7305feb6528caef8fbef84
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
drivers/scsi/sd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -638,7 +638,7 @@ static void sd_config_discard(struct scs
*/
if (sdkp->lbprz) {
q->limits.discard_alignment = 0;
- q->limits.discard_granularity = 1;
+ q->limits.discard_granularity = logical_block_size;
} else {
q->limits.discard_alignment = sdkp->unmap_alignment *
logical_block_size;