]> granicus.if.org Git - zfs/commitdiff
Add SCSI_PASSTHROUGH to zvols to enable UNMAP support
authorPaul Dagnelie <pcd@delphix.com>
Fri, 21 Jun 2019 16:40:56 +0000 (09:40 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 21 Jun 2019 16:40:56 +0000 (09:40 -0700)
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 <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: John Gallagher <john.gallagher@delphix.com>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes #8933

module/zfs/zvol.c

index 9aeadb22b67c220e122b85d29056c21eb9e99447..f74eb28aec86999c96383189896f04c23ad10b95 100644 (file)
@@ -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)