Print this page
7448 nvme: performance regression when volatile write cache not present
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>

@@ -2505,10 +2505,11 @@
         int instance;
         int nregs;
         off_t regsize;
         int i;
         char name[32];
+        bd_ops_t l_bd_ops = nvme_bd_ops;
 
         if (cmd != DDI_ATTACH)
                 return (DDI_FAILURE);
 
         instance = ddi_get_instance(dip);

@@ -2641,12 +2642,16 @@
          */
         for (i = 0; i != nvme->n_namespace_count; i++) {
                 if (nvme->n_ns[i].ns_ignore)
                         continue;
 
+                if (!nvme->n_write_cache_present) {
+                        l_bd_ops.o_sync_cache = NULL;
+                }
+
                 nvme->n_ns[i].ns_bd_hdl = bd_alloc_handle(&nvme->n_ns[i],
-                    &nvme_bd_ops, &nvme->n_prp_dma_attr, KM_SLEEP);
+                    &l_bd_ops, &nvme->n_prp_dma_attr, KM_SLEEP);
 
                 if (nvme->n_ns[i].ns_bd_hdl == NULL) {
                         dev_err(dip, CE_WARN,
                             "!failed to get blkdev handle for namespace %d", i);
                         goto fail;