Cleanup: split bdi_dirty_ratelimit with ifdef into separate macros
[lttng-modules.git] / instrumentation / events / lttng-module / writeback.h
index b2148d86b5079ded37d7c60b94a1a96e6fb1e1d4..5eeec4ad7e1f2a2ece138e3343ecc59ecf48c5fa 100644 (file)
@@ -57,18 +57,6 @@ static inline struct backing_dev_info *inode_to_bdi(struct inode *inode)
        )
 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-#define WB_WORK_REASON                                                 \
-               {WB_REASON_BACKGROUND,          "background"},          \
-               {WB_REASON_TRY_TO_FREE_PAGES,   "try_to_free_pages"},   \
-               {WB_REASON_SYNC,                "sync"},                \
-               {WB_REASON_PERIODIC,            "periodic"},            \
-               {WB_REASON_LAPTOP_TIMER,        "laptop_timer"},        \
-               {WB_REASON_FREE_MORE_MEM,       "free_more_memory"},    \
-               {WB_REASON_FS_FREE_SPACE,       "fs_free_space"},       \
-               {WB_REASON_FORKER_THREAD,       "forker_thread"}
-#endif
-
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
 
 LTTNG_TRACEPOINT_EVENT(writeback_dirty_page,
@@ -363,6 +351,32 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
 
 #define KBps(x)                        ((x) << (PAGE_SHIFT - 10))
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0))
+
+LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit,
+
+       writeback_bdi_dirty_ratelimit,
+
+       TP_PROTO(struct backing_dev_info *bdi,
+                unsigned long dirty_rate,
+                unsigned long task_ratelimit),
+
+       TP_ARGS(bdi, dirty_rate, task_ratelimit),
+
+       TP_FIELDS(
+               ctf_array_text(char, bdi, dev_name(bdi->dev), 32)
+               ctf_integer(unsigned long, write_bw, KBps(bdi->wb.write_bandwidth))
+               ctf_integer(unsigned long, avg_write_bw, KBps(bdi->wb.avg_write_bandwidth))
+               ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate))
+               ctf_integer(unsigned long, dirty_ratelimit, KBps(bdi->wb.dirty_ratelimit))
+               ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit))
+               ctf_integer(unsigned long, balanced_dirty_ratelimit,
+                                       KBps(bdi->wb.balanced_dirty_ratelimit))
+       )
+)
+
+#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) */
+
 LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit,
 
        writeback_bdi_dirty_ratelimit,
@@ -385,6 +399,8 @@ LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit,
        )
 )
 
+#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) */
+
 LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages,
 
        writeback_balance_dirty_pages,
This page took 0.024719 seconds and 4 git commands to generate.