[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <148488428321.37913.17056461381323304389.stgit@dwillia2-desk3.amr.corp.intel.com>
Date: Thu, 19 Jan 2017 19:51:23 -0800
From: Dan Williams <dan.j.williams@...el.com>
To: linux-nvdimm@...ts.01.org
Cc: Jan Kara <jack@...e.cz>, Matthew Wilcox <mawilcox@...rosoft.com>,
linux-kernel@...r.kernel.org, Jeff Moyer <jmoyer@...hat.com>,
linux-fsdevel@...r.kernel.org,
Ross Zwisler <ross.zwisler@...ux.intel.com>,
Christoph Hellwig <hch@....de>
Subject: [PATCH 13/13] libnvdimm,
pmem: disable dax flushing for 'cache flush on fail' platforms
There are platforms that arrange for caches to be flushed on a power
fail event. When the platform has this capability it is redundant to
spend cycles flushing caches at fsync(). Provide a libnvdimm module
parameter to override the default flushing behavior since there is no
other mechanism defined to detect this platform property.
Cc: Jan Kara <jack@...e.cz>
Cc: Jeff Moyer <jmoyer@...hat.com>
Cc: Christoph Hellwig <hch@....de>
Cc: Matthew Wilcox <mawilcox@...rosoft.com>
Cc: Ross Zwisler <ross.zwisler@...ux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@...el.com>
---
drivers/nvdimm/region_devs.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
index ef32b938023e..4cc7fbc4f13f 100644
--- a/drivers/nvdimm/region_devs.c
+++ b/drivers/nvdimm/region_devs.c
@@ -11,6 +11,7 @@
* General Public License for more details.
*/
#include <linux/scatterlist.h>
+#include <linux/moduleparam.h>
#include <linux/highmem.h>
#include <linux/sched.h>
#include <linux/slab.h>
@@ -21,6 +22,11 @@
#include "nd-core.h"
#include "nd.h"
+static bool platform_has_flush_on_fail;
+module_param(platform_has_flush_on_fail, bool, 00444);
+MODULE_PARM_DESC(platform_has_flush_on_fail,
+ "Platform arranges for cpu caches to be flushed on power failure");
+
/*
* For readq() and writeq() on 32-bit builds, the hi-lo, lo-hi order is
* irrelevant.
@@ -963,6 +969,11 @@ int nvdimm_has_flush(struct nd_region *nd_region)
struct nd_region_data *ndrd = dev_get_drvdata(&nd_region->dev);
int i;
+ if (platform_has_flush_on_fail) {
+ pr_info_once("libnvdimm.platform_has_flush_on_fail enabled\n");
+ return -EINVAL;
+ }
+
if (is_nd_volatile(&nd_region->dev))
return -EINVAL;
Powered by blists - more mailing lists