From: Martin K. Petersen Date: Sat, 5 Mar 2016 22:52:02 +0000 (-0500) Subject: sd: Fix discard granularity when LBPRZ=1 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=f4327a95dd080ed6aecb185478a88ce1ee4fa3c4;p=linux-beck.git sd: Fix discard granularity when LBPRZ=1 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 Cc: #v4.4+ --- diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index d749da765df1..5a5457ac9cdb 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;