Skip to content

Commit

Permalink
sd: Fix discard granularity when LBPRZ=1
Browse files Browse the repository at this point in the history
Commit 3977372 ("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 <[email protected]>
Reported-by: Mike Snitzer <[email protected]>
Reviewed-by: Ewan Milne <[email protected]>
Reviewed-by: Bart Van Assche <[email protected]>
Fixes: 3977372
Cc: <[email protected]> #v4.4+
  • Loading branch information
martinkpetersen committed Mar 14, 2016
1 parent 6888758 commit f4327a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/scsi/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f4327a9

Please sign in to comment.