target: Fix iblock se_dev_attrib.unmap_granularity
authorMarco Sanvido <marco@purestorage.com>
Fri, 20 Jan 2012 23:49:27 +0000 (15:49 -0800)
committerNicholas Bellinger <nab@linux-iscsi.org>
Tue, 7 Feb 2012 06:48:20 +0000 (06:48 +0000)
The block layer keeps q->limits.discard_granularity in bytes, but iblock
(and the SCSI Block Limits VPD page) keep unmap_granularity in blocks.
Report the correct value when exporting block devices by dividing to
convert bytes to blocks.

Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_iblock.c

index 628e877..d43d5eb 100644 (file)
@@ -181,7 +181,7 @@ static struct se_device *iblock_create_virtdevice(
                 */
                dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count = 1;
                dev->se_sub_dev->se_dev_attrib.unmap_granularity =
-                               q->limits.discard_granularity;
+                               q->limits.discard_granularity >> 9;
                dev->se_sub_dev->se_dev_attrib.unmap_granularity_alignment =
                                q->limits.discard_alignment;