]> www.infradead.org Git - users/hch/block.git/commitdiff
target: fix discard alignment on partitions
authorChristoph Hellwig <hch@lst.de>
Tue, 15 Feb 2022 10:31:56 +0000 (11:31 +0100)
committerChristoph Hellwig <hch@lst.de>
Thu, 14 Apr 2022 04:20:45 +0000 (06:20 +0200)
Use the proper bdev_discard_alignment helper that accounts for partition
offsets.

Fixes: c66ac9db8d4a ("[SCSI] target: Add LIO target core v4.0.0-rc6")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/target/target_core_device.c

index 3a1ec705cd80b34133298cdc2059c237ac8163a4..16e775bcf4a7c06809a939621400fee937846855 100644 (file)
@@ -849,8 +849,8 @@ bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib,
         */
        attrib->max_unmap_block_desc_count = 1;
        attrib->unmap_granularity = q->limits.discard_granularity / block_size;
-       attrib->unmap_granularity_alignment = q->limits.discard_alignment /
-                                                               block_size;
+       attrib->unmap_granularity_alignment =
+               bdev_discard_alignment(bdev) / block_size;
        return true;
 }
 EXPORT_SYMBOL(target_configure_unmap_from_queue);