aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Dagnelie <[email protected]>2019-06-21 09:40:56 -0700
committerBrian Behlendorf <[email protected]>2019-06-21 09:40:56 -0700
commita370182fed893c65c4d5a6ec96ce70535e861c62 (patch)
treee5a448aaa8e421159a1e6d6a1b2c9ac752772de1
parent3976fd65d367a4a40c075f64763f79e6496ed917 (diff)
Add SCSI_PASSTHROUGH to zvols to enable UNMAP support
When exporting ZVOLs as SCSI LUNs, by default Windows will not issue them UNMAP commands. This reduces storage efficiency in many cases. We add the SCSI_PASSTHROUGH flag to the zvol's device queue, which lets the SCSI target logic know that it can handle SCSI commands. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Melikov <[email protected]> Reviewed-by: John Gallagher <[email protected]> Signed-off-by: Paul Dagnelie <[email protected]> Closes #8933
-rw-r--r--module/zfs/zvol.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c
index 9aeadb22b..f74eb28ae 100644
--- a/module/zfs/zvol.c
+++ b/module/zfs/zvol.c
@@ -1876,6 +1876,10 @@ zvol_create_minor_impl(const char *name)
#ifdef QUEUE_FLAG_ADD_RANDOM
blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, zv->zv_queue);
#endif
+ /* This flag was introduced in kernel version 4.12. */
+#ifdef QUEUE_FLAG_SCSI_PASSTHROUGH
+ blk_queue_flag_set(QUEUE_FLAG_SCSI_PASSTHROUGH, zv->zv_queue);
+#endif
if (spa_writeable(dmu_objset_spa(os))) {
if (zil_replay_disable)