[SCSI] sd: Unmap discard alignment needs to be converted to bytes
authorMartin K. Petersen <martin.petersen@oracle.com>
Wed, 18 May 2011 04:31:07 +0000 (00:31 -0400)
committerJames Bottomley <jbottomley@parallels.com>
Tue, 24 May 2011 16:38:15 +0000 (12:38 -0400)
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>
drivers/scsi/sd.c

index bd0806e64e857172a8af6061a87b0e4b52758836..1c69c14be0cd5f80fe72dadd97021f666f9b9b16 100644 (file)
@@ -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);