Module Name:    src
Committed By:   jdolecek
Date:           Tue Feb 28 20:55:09 UTC 2017

Modified Files:
        src/sys/dev/ic: ld_nvme.c

Log Message:
change DIOCCACHESYNC to not issue the FLUSH command at all when the controller
has no volatile write cache


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/ld_nvme.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/ld_nvme.c
diff -u src/sys/dev/ic/ld_nvme.c:1.13 src/sys/dev/ic/ld_nvme.c:1.14
--- src/sys/dev/ic/ld_nvme.c:1.13	Tue Feb 28 20:53:50 2017
+++ src/sys/dev/ic/ld_nvme.c	Tue Feb 28 20:55:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_nvme.c,v 1.13 2017/02/28 20:53:50 jdolecek Exp $	*/
+/*	$NetBSD: ld_nvme.c,v 1.14 2017/02/28 20:55:09 jdolecek Exp $	*/
 
 /*-
  * Copyright (C) 2016 NONAKA Kimihiro <non...@netbsd.org>
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.13 2017/02/28 20:53:50 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.14 2017/02/28 20:55:09 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -199,6 +199,11 @@ ld_nvme_flush(struct ld_softc *ld, bool 
 {
 	struct ld_nvme_softc *sc = device_private(ld->sc_dv);
 
+	if (!nvme_has_volatile_write_cache(sc->sc_nvme)) {
+		/* cache not present, no value in trying to flush it */
+		return 0;
+	}
+
 	return nvme_ns_sync(sc->sc_nvme, sc->sc_nsid, sc,
 	    poll ? NVME_NS_CTX_F_POLL : 0,
 	    ld_nvme_syncdone);

Reply via email to