Add a helper function that checks of the file_operations is dax.
Signed-off-by: Dave Jiang <[email protected]>
---
include/linux/dax.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/include/linux/dax.h b/include/linux/dax.h
index 9d624f4d9df6..a5e1a3ca1a0d 100644
--- a/include/linux/dax.h
+++ b/include/linux/dax.h
@@ -311,4 +311,11 @@ static inline void hmem_register_resource(int target_nid,
struct resource *r)
typedef int (*walk_hmem_fn)(struct device *dev, int target_nid,
const struct resource *res);
int walk_hmem_resources(struct device *dev, walk_hmem_fn fn);
+
+extern const struct file_operations dax_fops;
+static inline bool is_file_dax(struct file *file)
+{
+ return file->f_op == &dax_fops;
+}
+
#endif
--
2.53.0