Add these helper functions, and export them for filesystem use.
Signed-off-by: Shiyang Ruan
---
drivers/dax/super.c | 19 +++
include/linux/dax.h | 15 +++
2 files changed, 34 insertions(+)
diff --git a/drivers/dax/super.c b/drivers/dax/super.c
index a19fcc0a54f3..acbe7078ce4c 100644
--- a/drivers/dax/super.c
+++ b/drivers/dax/super.c
@@ -114,6 +114,25 @@ struct dax_device *fs_dax_get_by_bdev(struct block_device
*bdev, u64 *start_off)
return dax_dev;
}
EXPORT_SYMBOL_GPL(fs_dax_get_by_bdev);
+
+void fs_dax_register_holder(struct dax_device *dax_dev, void *holder,
+ const struct dax_holder_operations *ops)
+{
+ dax_set_holder(dax_dev, holder, ops);
+}
+EXPORT_SYMBOL_GPL(fs_dax_register_holder);
+
+void fs_dax_unregister_holder(struct dax_device *dax_dev)
+{
+ dax_set_holder(dax_dev, NULL, NULL);
+}
+EXPORT_SYMBOL_GPL(fs_dax_unregister_holder);
+
+void *fs_dax_get_holder(struct dax_device *dax_dev)
+{
+ return dax_get_holder(dax_dev);
+}
+EXPORT_SYMBOL_GPL(fs_dax_get_holder);
#endif /* CONFIG_BLOCK && CONFIG_FS_DAX */
enum dax_device_flags {
diff --git a/include/linux/dax.h b/include/linux/dax.h
index 500d048d444e..15a0ad4c248d 100644
--- a/include/linux/dax.h
+++ b/include/linux/dax.h
@@ -140,6 +140,10 @@ static inline void fs_put_dax(struct dax_device *dax_dev)
{
put_dax(dax_dev);
}
+void fs_dax_register_holder(struct dax_device *dax_dev, void *holder,
+ const struct dax_holder_operations *ops);
+void fs_dax_unregister_holder(struct dax_device *dax_dev);
+void *fs_dax_get_holder(struct dax_device *dax_dev);
#else
static inline int dax_add_host(struct dax_device *dax_dev, struct gendisk
*disk)
{
@@ -156,6 +160,17 @@ static inline struct dax_device *fs_dax_get_by_bdev(struct
block_device *bdev,
static inline void fs_put_dax(struct dax_device *dax_dev)
{
}
+static inline void fs_dax_register_holder(struct dax_device *dax_dev,
+ void *holder, const struct dax_holder_operations *ops)
+{
+}
+static inline void fs_dax_unregister_holder(struct dax_device *dax_dev)
+{
+}
+static inline void *fs_dax_get_holder(struct dax_device *dax_dev)
+{
+ return NULL;
+}
#endif /* CONFIG_BLOCK && CONFIG_FS_DAX */
#if IS_ENABLED(CONFIG_FS_DAX)
--
2.34.0