fix: version ranges for ext4_discard_preallocations and writeback_queue_io
[lttng-modules.git] / instrumentation / events / lttng-module / writeback.h
index 6006c2945fecdc61f71bc62afdba025f0aaf98cb..09637d7c7114285fa51952bb982ee2cbc97a58f2 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM writeback
 
@@ -45,7 +46,21 @@ static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
 
 #endif
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
+#define show_inode_state(state)                                        \
+       __print_flags(state, "|",                               \
+               {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
+               {I_DIRTY_DATASYNC,      "I_DIRTY_DATASYNC"},    \
+               {I_DIRTY_PAGES,         "I_DIRTY_PAGES"},       \
+               {I_NEW,                 "I_NEW"},               \
+               {I_WILL_FREE,           "I_WILL_FREE"},         \
+               {I_FREEING,             "I_FREEING"},           \
+               {I_CLEAR,               "I_CLEAR"},             \
+               {I_SYNC,                "I_SYNC"},              \
+               {I_DIRTY_TIME,          "I_DIRTY_TIME"},        \
+               {I_REFERENCED,          "I_REFERENCED"}         \
+       )
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
 #define show_inode_state(state)                                        \
        __print_flags(state, "|",                               \
                {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
@@ -307,9 +322,7 @@ DEFINE_WRITEBACK_EVENT(writeback_bdi_register)
 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
 
 DEFINE_WRITEBACK_EVENT(writeback_nowork)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
 DEFINE_WRITEBACK_EVENT(writeback_wake_background)
-#endif
 DEFINE_WRITEBACK_EVENT(writeback_wake_thread)
 DEFINE_WRITEBACK_EVENT(writeback_wake_forker_thread)
 DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister)
@@ -371,35 +384,103 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
 #endif
 LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
+       LTTNG_KERNEL_RANGE(5,8,6, 5,9,0) || \
+       LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) || \
+       LTTNG_KERNEL_RANGE(4,19,143, 4,20,0) || \
+       LTTNG_KERNEL_RANGE(4,14,196, 4,15,0) || \
+       LTTNG_KERNEL_RANGE(4,9,235, 4,10,0) || \
+       LTTNG_KERNEL_RANGE(4,4,235, 4,5,0))
+LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
+       TP_PROTO(struct bdi_writeback *wb,
+                struct wb_writeback_work *work,
+                unsigned long dirtied_before,
+                int moved),
+       TP_ARGS(wb, work, dirtied_before, moved),
+       TP_FIELDS(
+               ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
+               ctf_integer(unsigned long, older, dirtied_before)
+               ctf_integer(int, moved, moved)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
 LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
        TP_PROTO(struct bdi_writeback *wb,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
                 struct wb_writeback_work *work,
-#else
-                unsigned long *older_than_this,
-#endif
                 int moved),
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
        TP_ARGS(wb, work, moved),
-#else
+       TP_FIELDS(
+               ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
+               ctf_integer(int, moved, moved)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
+LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
+       TP_PROTO(struct bdi_writeback *wb,
+                unsigned long *older_than_this,
+                int moved),
        TP_ARGS(wb, older_than_this, moved),
-#endif
        TP_FIELDS(
                ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-#else
                ctf_integer(unsigned long, older,
                        older_than_this ? *older_than_this : 0)
                ctf_integer(long, age,
                        older_than_this ?
                                (jiffies - *older_than_this) * 1000 / HZ
                                : -1)
-#endif
                ctf_integer(int, moved, moved)
        )
 )
+#endif
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
+LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
+
+       writeback_global_dirty_state,
+
+       TP_PROTO(unsigned long background_thresh,
+                unsigned long dirty_thresh
+       ),
+
+       TP_ARGS(background_thresh,
+               dirty_thresh
+       ),
+
+       TP_FIELDS(
+               ctf_integer(unsigned long, nr_dirty, global_node_page_state(NR_FILE_DIRTY))
+               ctf_integer(unsigned long, nr_writeback, global_node_page_state(NR_WRITEBACK))
+               ctf_integer(unsigned long, nr_dirtied, global_node_page_state(NR_DIRTIED))
+               ctf_integer(unsigned long, nr_written, global_node_page_state(NR_WRITTEN))
+               ctf_integer(unsigned long, background_thresh, background_thresh)
+               ctf_integer(unsigned long, dirty_thresh, dirty_thresh)
+               ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
+LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
+
+       writeback_global_dirty_state,
+
+       TP_PROTO(unsigned long background_thresh,
+                unsigned long dirty_thresh
+       ),
+
+       TP_ARGS(background_thresh,
+               dirty_thresh
+       ),
+
+       TP_FIELDS(
+               ctf_integer(unsigned long, nr_dirty, global_node_page_state(NR_FILE_DIRTY))
+               ctf_integer(unsigned long, nr_writeback, global_node_page_state(NR_WRITEBACK))
+               ctf_integer(unsigned long, nr_unstable, global_node_page_state(NR_UNSTABLE_NFS))
+               ctf_integer(unsigned long, nr_dirtied, global_node_page_state(NR_DIRTIED))
+               ctf_integer(unsigned long, nr_written, global_node_page_state(NR_WRITTEN))
+               ctf_integer(unsigned long, background_thresh, background_thresh)
+               ctf_integer(unsigned long, dirty_thresh, dirty_thresh)
+               ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
+       )
+)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
 LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
 
        writeback_global_dirty_state,
@@ -634,7 +715,6 @@ LTTNG_TRACEPOINT_EVENT(writeback_sb_inodes_requeue,
 )
 #endif
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_congest_waited_template,
 
        TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
@@ -660,7 +740,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_wai
 
        TP_ARGS(usec_timeout, usec_delayed)
 )
-#endif
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_single_inode_template,
This page took 0.027543 seconds and 4 git commands to generate.