Skip to content

Commit

Permalink
[SCSI] sd: Unmap discard alignment needs to be converted to bytes
Browse files Browse the repository at this point in the history
The block layer discard alignment is reported in bytes, not in units of
the logical block size.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <jbottomley@parallels.com>
  • Loading branch information
Martin K. Petersen authored and James Bottomley committed May 24, 2011
1 parent 45d7f0c commit 2a8cfad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/scsi/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,8 @@ static void sd_config_discard(struct scsi_disk *sdkp, unsigned int mode)
unsigned int max_blocks = 0;

q->limits.discard_zeroes_data = sdkp->lbprz;
q->limits.discard_alignment = sdkp->unmap_alignment;
q->limits.discard_alignment = sdkp->unmap_alignment *
logical_block_size;
q->limits.discard_granularity =
max(sdkp->physical_block_size,
sdkp->unmap_granularity * logical_block_size);
Expand Down

0 comments on commit 2a8cfad

Please sign in to comment.