1 From 66d0869cf54ed79a33345f537dce2f7840e279f0 Mon Sep 17 00:00:00 2001
2 From: Bruce Ashfield <bruce.ashfield@gmail.com>
3 Date: Tue, 29 Sep 2020 10:28:20 -0400
4 Subject: [PATCH] lttng-modules: backport writeback.h changes from 2.12.x to
7 Backporting the kernel version changes for writeback.h to fix
8 compilation against kernel stable versions 5.4.62+
10 This is a combination of upstream commits:
12 87b2aff [fix: writeback: Fix sync livelock due to b_dirty_time processing (v5.9)]
13 b74b25f [fix: version ranges for ext4_discard_preallocations and writeback_queue_io
15 Upstream-status: Backport
17 Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
19 .../events/lttng-module/writeback.h | 48 +++++++++++++------
20 1 file changed, 33 insertions(+), 15 deletions(-)
22 diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
23 index 3327a0f..8d2250e 100644
24 --- a/instrumentation/events/lttng-module/writeback.h
25 +++ b/instrumentation/events/lttng-module/writeback.h
26 @@ -372,34 +372,55 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
28 LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
30 -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
31 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
32 + LTTNG_KERNEL_RANGE(5,8,6, 5,9,0) || \
33 + LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) || \
34 + LTTNG_KERNEL_RANGE(4,19,143, 4,20,0) || \
35 + LTTNG_KERNEL_RANGE(4,14,196, 4,15,0) || \
36 + LTTNG_KERNEL_RANGE(4,9,235, 4,10,0) || \
37 + LTTNG_KERNEL_RANGE(4,4,235, 4,5,0) || \
38 + LTTNG_UBUNTU_KERNEL_RANGE(4,15,18,119, 4,16,0,0))
39 +LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
40 + TP_PROTO(struct bdi_writeback *wb,
41 + struct wb_writeback_work *work,
42 + unsigned long dirtied_before,
44 + TP_ARGS(wb, work, dirtied_before, moved),
46 + ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
47 + ctf_integer(unsigned long, older, dirtied_before)
48 + ctf_integer(int, moved, moved)
51 +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
52 LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
53 TP_PROTO(struct bdi_writeback *wb,
54 -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
55 struct wb_writeback_work *work,
57 - unsigned long *older_than_this,
60 -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
61 TP_ARGS(wb, work, moved),
64 + ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
65 + ctf_integer(int, moved, moved)
68 +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
69 +LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
70 + TP_PROTO(struct bdi_writeback *wb,
71 + unsigned long *older_than_this,
73 TP_ARGS(wb, older_than_this, moved),
76 ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
77 -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
79 ctf_integer(unsigned long, older,
80 older_than_this ? *older_than_this : 0)
81 ctf_integer(long, age,
83 (jiffies - *older_than_this) * 1000 / HZ
86 ctf_integer(int, moved, moved)
91 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
92 LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
93 @@ -425,7 +446,7 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
94 ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
98 +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
99 LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
101 writeback_global_dirty_state,
102 @@ -450,7 +471,6 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
108 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
110 @@ -661,7 +681,6 @@ LTTNG_TRACEPOINT_EVENT(writeback_sb_inodes_requeue,
114 -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
115 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_congest_waited_template,
117 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
118 @@ -687,7 +706,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_wai
120 TP_ARGS(usec_timeout, usec_delayed)
124 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
125 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_single_inode_template,