Skip to contentSkip to conversation

dax: add set_dax_nomc() and set_dax_nocache() stub helpers

PATCH In review Arnd Bergmann 2 participants 2 messages Feb 16, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dax: add set_dax_nomc() and set_dax_nocache() stub helpers

From: Arnd Bergmann <[email protected]>

In some randconfig builds, the IS_ERR() check appears to not get completely eliminated, resulting in the compiler to insert references to these two functions that cause a link failure:

ERROR: modpost: "set_dax_nocache" [drivers/md/dm-mod.ko] undefined!
ERROR: modpost: "set_dax_nomc" [drivers/md/dm-mod.ko] undefined!

Add more stub functions for the dax-disabled case here to make it build again.

Fixes d888f6b0a766 ("dm: treat alloc_dax() -EOPNOTSUPP failure as non-fatal")
---
 include/linux/dax.h | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
include/linux/dax.h +9 -3
index df2d52b8a245..4527c10016fb 100644
@@ -64,6 +64,9 @@ void dax_write_cache(struct dax_device *dax_dev, bool wc);
 bool dax_write_cache_enabled(struct dax_device *dax_dev);
 bool dax_synchronous(struct dax_device *dax_dev);
 void set_dax_synchronous(struct dax_device *dax_dev);
+void set_dax_nocache(struct dax_device *dax_dev);
+void set_dax_nomc(struct dax_device *dax_dev);
+
 size_t dax_recovery_write(struct dax_device *dax_dev, pgoff_t pgoff,
 		void *addr, size_t bytes, struct iov_iter *i);
 /*
@@ -108,6 +111,12 @@ static inline bool dax_synchronous(struct dax_device *dax_dev)
 static inline void set_dax_synchronous(struct dax_device *dax_dev)
 {
 }
+static inline void set_dax_nocache(struct dax_device *dax_dev)
+{
+}
+static inline void set_dax_nomc(struct dax_device *dax_dev)
+{
+}
 static inline bool daxdev_mapping_supported(struct vm_area_struct *vma,
 				struct dax_device *dax_dev)
 {
@@ -120,9 +129,6 @@ static inline size_t dax_recovery_write(struct dax_device *dax_dev,
 }
 #endif
 
-void set_dax_nocache(struct dax_device *dax_dev);
-void set_dax_nomc(struct dax_device *dax_dev);
-
 struct writeback_control;
 #if defined(CONFIG_BLOCK) && defined(CONFIG_FS_DAX)
 int dax_add_host(struct dax_device *dax_dev, struct gendisk *disk);
Signature · 1 line
2.39.2
#1 lore raw
Quoted 10 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

In some randconfig builds, the IS_ERR() check appears to not get completely eliminated, resulting in the compiler to insert references to these two functions that cause a link failure:

ERROR: modpost: "set_dax_nocache" [drivers/md/dm-mod.ko] undefined!
ERROR: modpost: "set_dax_nomc" [drivers/md/dm-mod.ko] undefined!

Add more stub functions for the dax-disabled case here to make it build again.

Hi Arnd,

Note that this is a duplicate of:

https://lore.kernel.org/lkml/[email protected]/

now present in Andrew's tree.

The only differences are the subject, commit message and a newline between "set_dax_nomc" and "set_dax_synchronous" in your change.

Thanks,

Mathieu

Quoted 46 lines
Fixes d888f6b0a766 ("dm: treat alloc_dax() -EOPNOTSUPP failure as non-fatal")
---
  include/linux/dax.h | 12 +++++++++---
  1 file changed, 9 insertions(+), 3 deletions(-)
include/linux/dax.h +9 -3
index df2d52b8a245..4527c10016fb 100644
@@ -64,6 +64,9 @@ void dax_write_cache(struct dax_device *dax_dev, bool wc);
  bool dax_write_cache_enabled(struct dax_device *dax_dev);
  bool dax_synchronous(struct dax_device *dax_dev);
  void set_dax_synchronous(struct dax_device *dax_dev);
+void set_dax_nocache(struct dax_device *dax_dev);
+void set_dax_nomc(struct dax_device *dax_dev);
+
  size_t dax_recovery_write(struct dax_device *dax_dev, pgoff_t pgoff,
  		void *addr, size_t bytes, struct iov_iter *i);
  /*
@@ -108,6 +111,12 @@ static inline bool dax_synchronous(struct dax_device *dax_dev)
  static inline void set_dax_synchronous(struct dax_device *dax_dev)
  {
  }
+static inline void set_dax_nocache(struct dax_device *dax_dev)
+{
+}
+static inline void set_dax_nomc(struct dax_device *dax_dev)
+{
+}
  static inline bool daxdev_mapping_supported(struct vm_area_struct *vma,
  				struct dax_device *dax_dev)
  {
@@ -120,9 +129,6 @@ static inline size_t dax_recovery_write(struct dax_device *dax_dev,
  }
  #endif
 
-void set_dax_nocache(struct dax_device *dax_dev);
-void set_dax_nomc(struct dax_device *dax_dev);
-
  struct writeback_control;
  #if defined(CONFIG_BLOCK) && defined(CONFIG_FS_DAX)
  int dax_add_host(struct dax_device *dax_dev, struct gendisk *disk);
Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com