summaryrefslogtreecommitdiffstats
path: root/drivers/dax
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2017-05-29 13:02:52 -0700
committerDan Williams <dan.j.williams@intel.com>2017-06-15 14:34:59 -0700
commitabebfbe2f7315dd3ec9a0c69596a76e32beb5749 (patch)
treee0b8a531424d7625e19a82a9151fa64a0a30671b /drivers/dax
parent3c1cebff23cdca01c421411e953a9e239f2b9ef9 (diff)
downloadlinux-abebfbe2f7315dd3ec9a0c69596a76e32beb5749.tar.gz
linux-abebfbe2f7315dd3ec9a0c69596a76e32beb5749.tar.bz2
linux-abebfbe2f7315dd3ec9a0c69596a76e32beb5749.zip
dm: add ->flush() dax operation support
Allow device-mapper to route flush operations to the per-target implementation. In order for the device stacking to work we need a dax_dev and a pgoff relative to that device. This gives each layer of the stack the information it needs to look up the operation pointer for the next level. This conceptually allows for an array of mixed device drivers with varying flush implementations. Reviewed-by: Toshi Kani <toshi.kani@hpe.com> Reviewed-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dax')
-rw-r--r--drivers/dax/super.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/dax/super.c b/drivers/dax/super.c
index dd299e55f65d..b7729e4d351a 100644
--- a/drivers/dax/super.c
+++ b/drivers/dax/super.c
@@ -185,6 +185,17 @@ size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,
}
EXPORT_SYMBOL_GPL(dax_copy_from_iter);
+void dax_flush(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,
+ size_t size)
+{
+ if (!dax_alive(dax_dev))
+ return;
+
+ if (dax_dev->ops->flush)
+ dax_dev->ops->flush(dax_dev, pgoff, addr, size);
+}
+EXPORT_SYMBOL_GPL(dax_flush);
+
bool dax_alive(struct dax_device *dax_dev)
{
lockdep_assert_held(&dax_srcu);