From: Christoph Hellwig Date: Fri, 15 Apr 2022 04:52:34 +0000 (+0200) Subject: target: fix discard alignment on partitions X-Git-Tag: baikal/aarch64/sdk6.1~3900^2~75 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=24a2bdf8eb4d1477296534110c5bde2f0e5d4a45;p=kernel.git target: fix discard alignment on partitions Use the proper bdev_discard_alignment helper that accounts for partition offsets. Fixes: fb5d17acd631 ("[SCSI] target: Add LIO target core v4.0.0-rc6") Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Reviewed-by: Chaitanya Kulkarni Link: https://lore.kernel.org/r/20220415045258.199825-4-hch@lst.de Signed-off-by: Jens Axboe --- diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 3a1ec705cd80b..16e775bcf4a7c 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -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);