diff options
author | Dan Williams <dan.j.williams@intel.com> | 2017-01-24 18:44:18 -0800 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2017-04-19 15:14:35 -0700 |
commit | 6568b08b77816cda2a95919c7494108d983d5941 (patch) | |
tree | cdc776afdf8dd6c583155d169017eb78ab94a8bf /drivers/dax/super.c | |
parent | 72058005411ffddcae6c06f7b691d635489132af (diff) | |
download | linux-6568b08b77816cda2a95919c7494108d983d5941.tar.gz linux-6568b08b77816cda2a95919c7494108d983d5941.tar.bz2 linux-6568b08b77816cda2a95919c7494108d983d5941.zip |
dax: introduce dax_operations
Track a set of dax_operations per dax_device that can be set at
alloc_dax() time. These operations will be used to stop the abuse of
block_device_operations for communicating dax capabilities to
filesystems. It will also be used to replace the "pmem api" and move
pmem-specific cache maintenance, and other dax-driver-specific
filesystem-dax operations, to dax device methods. In particular this
allows us to stop abusing __copy_user_nocache(), via memcpy_to_pmem(),
with a driver specific replacement.
This is a standalone introduction of the operations. Follow on patches
convert each dax-driver and teach fs/dax.c to use ->direct_access() from
dax_operations instead of block_device_operations.
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dax/super.c')
-rw-r--r-- | drivers/dax/super.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/dax/super.c b/drivers/dax/super.c index 8d446674c1da..1a58542ee8fd 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -17,6 +17,7 @@ #include <linux/cdev.h> #include <linux/hash.h> #include <linux/slab.h> +#include <linux/dax.h> #include <linux/fs.h> static int nr_dax = CONFIG_NR_DEV_DAX; @@ -61,6 +62,7 @@ struct dax_device { const char *host; void *private; bool alive; + const struct dax_operations *ops; }; bool dax_alive(struct dax_device *dax_dev) @@ -208,7 +210,8 @@ static void dax_add_host(struct dax_device *dax_dev, const char *host) spin_unlock(&dax_host_lock); } -struct dax_device *alloc_dax(void *private, const char *__host) +struct dax_device *alloc_dax(void *private, const char *__host, + const struct dax_operations *ops) { struct dax_device *dax_dev; const char *host; @@ -229,6 +232,7 @@ struct dax_device *alloc_dax(void *private, const char *__host) goto err_dev; dax_add_host(dax_dev, host); + dax_dev->ops = ops; dax_dev->private = private; return dax_dev; |