Fix: btrfs_get_extent flags and compress_type changed in linux 6.8.0-rc1
[lttng-modules.git] / include / wrapper / writeback.h
index e5f36c258534a211ba76d8b3a316c2dc4bdb3ce1..71369ab260d2c655e213c8f8b799f3f4e32cdb93 100644 (file)
 #ifndef _LTTNG_WRAPPER_WRITEBACK_H
 #define _LTTNG_WRAPPER_WRITEBACK_H
 
-#include <lttng/kernel-version.h>
-
 #ifdef CONFIG_KALLSYMS_ALL
+
 #include <linux/kallsyms.h>
 #include <wrapper/kallsyms.h>
 
-
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)
-
 static struct wb_domain *global_wb_domain_sym;
 
 static inline
@@ -37,24 +32,19 @@ unsigned long wrapper_global_dirty_limit(void)
                return 0;
        }
 }
-#else
-
-static unsigned long *global_dirty_limit_sym;
 
+/*
+ * Canary function to check for 'global_wb_domain' at compile time.
+ *
+ * From 'include/linux/writeback.h':
+ *
+ *   extern struct wb_domain global_wb_domain;
+ */
 static inline
-unsigned long wrapper_global_dirty_limit(void)
+unsigned long __canary__global_wb_domain(void)
 {
-       if (!global_dirty_limit_sym)
-               global_dirty_limit_sym =
-                       (void *) kallsyms_lookup_dataptr("global_dirty_limit");
-       if (global_dirty_limit_sym) {
-               return *global_dirty_limit_sym;
-       } else {
-               printk_once(KERN_WARNING "LTTng: global_dirty_limit symbol lookup failed.\n");
-               return 0;
-       }
+       return global_wb_domain.dirty_limit;
 }
-#endif
 
 #else /* CONFIG_KALLSYMS_ALL */
 
@@ -66,6 +56,6 @@ unsigned long wrapper_global_dirty_limit(void)
        return global_dirty_limit;
 }
 
-#endif
+#endif /* CONFIG_KALLSYMS_ALL */
 
 #endif /* _LTTNG_WRAPPER_WRITEBACK_H */
This page took 0.029304 seconds and 4 git commands to generate.