]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
dax: remove default copy_from_iter fallback
authorDan Williams <dan.j.williams@intel.com>
Tue, 27 Jun 2017 20:06:22 +0000 (13:06 -0700)
committerDan Williams <dan.j.williams@intel.com>
Tue, 27 Jun 2017 23:44:27 +0000 (16:44 -0700)
Require all dax-drivers to register a ->copy_from_iter() operation so
that it is clear which dax_operations are optional and which must be
implemented for filesystem-dax to operate.

Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
arch/powerpc/sysdev/axonram.c
drivers/block/brd.c
drivers/dax/super.c
drivers/s390/block/dcssblk.c
include/linux/dax.h

index a7fe5fee744f55f8a548a1eb5288da5f9af54247..2799706106c63a3f5e3bc377d10385f3149a065d 100644 (file)
@@ -45,6 +45,7 @@
 #include <linux/of_device.h>
 #include <linux/of_platform.h>
 #include <linux/pfn_t.h>
+#include <linux/uio.h>
 
 #include <asm/page.h>
 #include <asm/prom.h>
@@ -163,8 +164,15 @@ axon_ram_dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pa
        return __axon_ram_direct_access(bank, pgoff, nr_pages, kaddr, pfn);
 }
 
+static size_t axon_ram_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff,
+               void *addr, size_t bytes, struct iov_iter *i)
+{
+       return copy_from_iter(addr, bytes, i);
+}
+
 static const struct dax_operations axon_ram_dax_ops = {
        .direct_access = axon_ram_dax_direct_access,
+       .copy_from_iter = axon_ram_copy_from_iter,
 };
 
 /**
index 57b574f2f66a9d75a86f56a187e0fc9273b7c593..f2a7ac350f6a74de238366b9dcfec2c735eebb32 100644 (file)
@@ -22,6 +22,7 @@
 #ifdef CONFIG_BLK_DEV_RAM_DAX
 #include <linux/pfn_t.h>
 #include <linux/dax.h>
+#include <linux/uio.h>
 #endif
 
 #include <linux/uaccess.h>
@@ -354,8 +355,15 @@ static long brd_dax_direct_access(struct dax_device *dax_dev,
        return __brd_direct_access(brd, pgoff, nr_pages, kaddr, pfn);
 }
 
+static size_t brd_dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff,
+               void *addr, size_t bytes, struct iov_iter *i)
+{
+       return copy_from_iter(addr, bytes, i);
+}
+
 static const struct dax_operations brd_dax_ops = {
        .direct_access = brd_dax_direct_access,
+       .copy_from_iter = brd_dax_copy_from_iter,
 };
 #endif
 
index b7729e4d351a0168a7d98d14751546747cab650a..9e0160b950d702a75863779c7e54d4d40581760b 100644 (file)
@@ -179,8 +179,6 @@ size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,
        if (!dax_alive(dax_dev))
                return 0;
 
-       if (!dax_dev->ops->copy_from_iter)
-               return copy_from_iter(addr, bytes, i);
        return dax_dev->ops->copy_from_iter(dax_dev, pgoff, addr, bytes, i);
 }
 EXPORT_SYMBOL_GPL(dax_copy_from_iter);
index 36e5280af3e442b5947881ad46b5a6faf61b0f10..88fa7b3f7a9db605f488369453972c588867b57d 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 #include <linux/pfn_t.h>
+#include <linux/uio.h>
 #include <linux/dax.h>
 #include <asm/extmem.h>
 #include <asm/io.h>
@@ -43,8 +44,15 @@ static const struct block_device_operations dcssblk_devops = {
        .release        = dcssblk_release,
 };
 
+static size_t dcssblk_dax_copy_from_iter(struct dax_device *dax_dev,
+               pgoff_t pgoff, void *addr, size_t bytes, struct iov_iter *i)
+{
+       return copy_from_iter(addr, bytes, i);
+}
+
 static const struct dax_operations dcssblk_dax_ops = {
        .direct_access = dcssblk_dax_direct_access,
+       .copy_from_iter = dcssblk_dax_copy_from_iter,
 };
 
 struct dcssblk_dev_info {
index 1f6b6072af64890b431267cdda15c7eddde1b70e..73fca1bebaf3afb37b8f78e97370016e9dfe5bb4 100644 (file)
@@ -16,7 +16,7 @@ struct dax_operations {
         */
        long (*direct_access)(struct dax_device *, pgoff_t, long,
                        void **, pfn_t *);
-       /* copy_from_iter: dax-driver override for default copy_from_iter */
+       /* copy_from_iter: required operation for fs-dax direct-i/o */
        size_t (*copy_from_iter)(struct dax_device *, pgoff_t, void *, size_t,
                        struct iov_iter *);
        /* flush: optional driver-specific cache management after writes */