[RFC PATCH] target: enable discard if supported by underlying block device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The initial commit of LIO (v4.0.0-rc6) came with support for SCSI UNMAP
disabled. This was justified in the LIO wiki with:
  Many SATA SSDs have issues handling UNMAP properly, so it is disabled
  per default in LIO.
Since this time, some critical discard bugs have been fixed, e.g.
f3f5da624e0a ("block: Do a full clone when splitting discard bios").

Block layer backed logical units are capable of deferring to the block
layer when determining UNMAP attributes, but this logic currently leaves
the emulate_tpu (UNMAP) and emulate_tpws (WRITE_SAME with UNMAP=1) flags
disabled.
With this change, emulate_tpu and emulate_tpws are set for block layer
backed logical units based on underlying block device discard support.

Signed-off-by: David Disseldorp <ddiss@xxxxxxx>
---
 drivers/target/target_core_device.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index e8dd6da164b2..65dab7c2460a 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -856,6 +856,8 @@ bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib,
 	attrib->unmap_granularity_alignment = q->limits.discard_alignment /
 								block_size;
 	attrib->unmap_zeroes_data = (q->limits.max_write_zeroes_sectors);
+	attrib->emulate_tpu = 1;
+	attrib->emulate_tpws = 1;
 	return true;
 }
 EXPORT_SYMBOL(target_configure_unmap_from_queue);
-- 
2.13.6

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux