dax: stub out dax_supported for !CONFIG_FS_DAX
authorChristoph Hellwig <hch@lst.de>
Thu, 26 Aug 2021 13:55:08 +0000 (15:55 +0200)
committerDan Williams <dan.j.williams@intel.com>
Thu, 26 Aug 2021 23:52:03 +0000 (16:52 -0700)
dax_supported calls into ->dax_supported which checks for fsdax support.
Don't bother building it for !CONFIG_FS_DAX as it will always return
false.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Link: https://lore.kernel.org/r/20210826135510.6293-8-hch@lst.de
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/dax/super.c
include/linux/dax.h

index 8e8ccb3..eed0272 100644 (file)
@@ -201,6 +201,24 @@ bool generic_fsdax_supported(struct dax_device *dax_dev,
        return true;
 }
 EXPORT_SYMBOL_GPL(generic_fsdax_supported);
+
+bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev,
+               int blocksize, sector_t start, sector_t len)
+{
+       bool ret = false;
+       int id;
+
+       if (!dax_dev)
+               return false;
+
+       id = dax_read_lock();
+       if (dax_alive(dax_dev) && dax_dev->ops->dax_supported)
+               ret = dax_dev->ops->dax_supported(dax_dev, bdev, blocksize,
+                                                 start, len);
+       dax_read_unlock(id);
+       return ret;
+}
+EXPORT_SYMBOL_GPL(dax_supported);
 #endif /* CONFIG_FS_DAX */
 
 /**
@@ -350,24 +368,6 @@ long dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages,
 }
 EXPORT_SYMBOL_GPL(dax_direct_access);
 
-bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev,
-               int blocksize, sector_t start, sector_t len)
-{
-       bool ret = false;
-       int id;
-
-       if (!dax_dev)
-               return false;
-
-       id = dax_read_lock();
-       if (dax_alive(dax_dev) && dax_dev->ops->dax_supported)
-               ret = dax_dev->ops->dax_supported(dax_dev, bdev, blocksize,
-                                                 start, len);
-       dax_read_unlock(id);
-       return ret;
-}
-EXPORT_SYMBOL_GPL(dax_supported);
-
 size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,
                size_t bytes, struct iov_iter *i)
 {
index 0a3ef97..32dce57 100644 (file)
@@ -57,8 +57,6 @@ static inline void set_dax_synchronous(struct dax_device *dax_dev)
 {
        __set_dax_synchronous(dax_dev);
 }
-bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev,
-               int blocksize, sector_t start, sector_t len);
 /*
  * Check if given mapping is supported by the file / underlying device.
  */
@@ -101,12 +99,6 @@ static inline bool dax_synchronous(struct dax_device *dax_dev)
 static inline void set_dax_synchronous(struct dax_device *dax_dev)
 {
 }
-static inline bool dax_supported(struct dax_device *dax_dev,
-               struct block_device *bdev, int blocksize, sector_t start,
-               sector_t len)
-{
-       return false;
-}
 static inline bool daxdev_mapping_supported(struct vm_area_struct *vma,
                                struct dax_device *dax_dev)
 {
@@ -127,6 +119,9 @@ bool generic_fsdax_supported(struct dax_device *dax_dev,
                struct block_device *bdev, int blocksize, sector_t start,
                sector_t sectors);
 
+bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev,
+               int blocksize, sector_t start, sector_t len);
+
 static inline void fs_put_dax(struct dax_device *dax_dev)
 {
        put_dax(dax_dev);
@@ -149,6 +144,13 @@ static inline bool bdev_dax_supported(struct block_device *bdev,
 
 #define generic_fsdax_supported                NULL
 
+static inline bool dax_supported(struct dax_device *dax_dev,
+               struct block_device *bdev, int blocksize, sector_t start,
+               sector_t len)
+{
+       return false;
+}
+
 static inline void fs_put_dax(struct dax_device *dax_dev)
 {
 }