All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] target: enable discard if supported by underlying block device
@ 2017-12-19 13:45 David Disseldorp
  2018-01-03 12:25 ` David Disseldorp
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: David Disseldorp @ 2017-12-19 13:45 UTC (permalink / raw)
  To: target-devel

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@suse.de>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-01-13  5:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-19 13:45 [RFC PATCH] target: enable discard if supported by underlying block device David Disseldorp
2018-01-03 12:25 ` David Disseldorp
2018-01-03 18:33 ` Mike Christie
2018-01-03 22:27 ` David Disseldorp
2018-01-13  5:13 ` Nicholas A. Bellinger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.