Thread (21 messages) 21 messages, 4 authors, 2021-12-16
STALE1649d
Revisions (11)
  1. v4 [diff vs current]
  2. v5 [diff vs current]
  3. v6 [diff vs current]
  4. v6 [diff vs current]
  5. v8 [diff vs current]
  6. v8 current
  7. v9 [diff vs current]
  8. v10 [diff vs current]
  9. v11 [diff vs current]
  10. v12 [diff vs current]
  11. v13 [diff vs current]

[PATCH v8 7/9] dax: add dax holder helper for filesystems

From: Shiyang Ruan <hidden>
Date: 2021-12-02 08:49:26
Also in: linux-fsdevel, linux-xfs, lkml, nvdimm
Subsystem: device direct access (dax), filesystem direct access (dax), the rest · Maintainers: Dan Williams, Vishal Verma, Dave Jiang, Alison Schofield, Linus Torvalds

Add these helper functions, and export them for filesystem use.

Signed-off-by: Shiyang Ruan <redacted>
---
 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



Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help