From: Martin K. Petersen Date: Sat, 5 Mar 2016 22:52:02 +0000 (-0500) Subject: sd: Fix discard granularity when LBPRZ=1 X-Git-Tag: firefly_0821_release~176^2~4^2~50^2~168 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=67aa7e6dd927c17103b3c5acb7eb50efb2372dab;p=firefly-linux-kernel-4.4.55.git sd: Fix discard granularity when LBPRZ=1 commit 6540a65da90c09590897310e31993b1f6e28485a 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 Reported-by: Mike Snitzer Reviewed-by: Ewan Milne Reviewed-by: Bart Van Assche Fixes: 397737223c59e89dca7305feb6528caef8fbef84 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index bb669d32ccd0..cc84ea7d09cc 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -648,7 +648,7 @@ static void sd_config_discard(struct scsi_disk *sdkp, unsigned int mode) */ 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;