hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/include/trace/events/filelock.h
....@@ -68,7 +68,7 @@
6868 __field(struct file_lock *, fl)
6969 __field(unsigned long, i_ino)
7070 __field(dev_t, s_dev)
71
- __field(struct file_lock *, fl_next)
71
+ __field(struct file_lock *, fl_blocker)
7272 __field(fl_owner_t, fl_owner)
7373 __field(unsigned int, fl_pid)
7474 __field(unsigned int, fl_flags)
....@@ -82,7 +82,7 @@
8282 __entry->fl = fl ? fl : NULL;
8383 __entry->s_dev = inode->i_sb->s_dev;
8484 __entry->i_ino = inode->i_ino;
85
- __entry->fl_next = fl ? fl->fl_next : NULL;
85
+ __entry->fl_blocker = fl ? fl->fl_blocker : NULL;
8686 __entry->fl_owner = fl ? fl->fl_owner : NULL;
8787 __entry->fl_pid = fl ? fl->fl_pid : 0;
8888 __entry->fl_flags = fl ? fl->fl_flags : 0;
....@@ -92,9 +92,9 @@
9292 __entry->ret = ret;
9393 ),
9494
95
- TP_printk("fl=0x%p dev=0x%x:0x%x ino=0x%lx fl_next=0x%p fl_owner=0x%p fl_pid=%u fl_flags=%s fl_type=%s fl_start=%lld fl_end=%lld ret=%d",
95
+ TP_printk("fl=%p dev=0x%x:0x%x ino=0x%lx fl_blocker=%p fl_owner=%p fl_pid=%u fl_flags=%s fl_type=%s fl_start=%lld fl_end=%lld ret=%d",
9696 __entry->fl, MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
97
- __entry->i_ino, __entry->fl_next, __entry->fl_owner,
97
+ __entry->i_ino, __entry->fl_blocker, __entry->fl_owner,
9898 __entry->fl_pid, show_fl_flags(__entry->fl_flags),
9999 show_fl_type(__entry->fl_type),
100100 __entry->fl_start, __entry->fl_end, __entry->ret)
....@@ -125,7 +125,7 @@
125125 __field(struct file_lock *, fl)
126126 __field(unsigned long, i_ino)
127127 __field(dev_t, s_dev)
128
- __field(struct file_lock *, fl_next)
128
+ __field(struct file_lock *, fl_blocker)
129129 __field(fl_owner_t, fl_owner)
130130 __field(unsigned int, fl_flags)
131131 __field(unsigned char, fl_type)
....@@ -137,7 +137,7 @@
137137 __entry->fl = fl ? fl : NULL;
138138 __entry->s_dev = inode->i_sb->s_dev;
139139 __entry->i_ino = inode->i_ino;
140
- __entry->fl_next = fl ? fl->fl_next : NULL;
140
+ __entry->fl_blocker = fl ? fl->fl_blocker : NULL;
141141 __entry->fl_owner = fl ? fl->fl_owner : NULL;
142142 __entry->fl_flags = fl ? fl->fl_flags : 0;
143143 __entry->fl_type = fl ? fl->fl_type : 0;
....@@ -145,9 +145,9 @@
145145 __entry->fl_downgrade_time = fl ? fl->fl_downgrade_time : 0;
146146 ),
147147
148
- TP_printk("fl=0x%p dev=0x%x:0x%x ino=0x%lx fl_next=0x%p fl_owner=0x%p fl_flags=%s fl_type=%s fl_break_time=%lu fl_downgrade_time=%lu",
148
+ TP_printk("fl=%p dev=0x%x:0x%x ino=0x%lx fl_blocker=%p fl_owner=%p fl_flags=%s fl_type=%s fl_break_time=%lu fl_downgrade_time=%lu",
149149 __entry->fl, MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
150
- __entry->i_ino, __entry->fl_next, __entry->fl_owner,
150
+ __entry->i_ino, __entry->fl_blocker, __entry->fl_owner,
151151 show_fl_flags(__entry->fl_flags),
152152 show_fl_type(__entry->fl_type),
153153 __entry->fl_break_time, __entry->fl_downgrade_time)
....@@ -176,7 +176,7 @@
176176 TP_STRUCT__entry(
177177 __field(unsigned long, i_ino)
178178 __field(int, wcount)
179
- __field(int, dcount)
179
+ __field(int, rcount)
180180 __field(int, icount)
181181 __field(dev_t, s_dev)
182182 __field(fl_owner_t, fl_owner)
....@@ -188,21 +188,56 @@
188188 __entry->s_dev = inode->i_sb->s_dev;
189189 __entry->i_ino = inode->i_ino;
190190 __entry->wcount = atomic_read(&inode->i_writecount);
191
- __entry->dcount = d_count(fl->fl_file->f_path.dentry);
191
+ __entry->rcount = atomic_read(&inode->i_readcount);
192192 __entry->icount = atomic_read(&inode->i_count);
193
- __entry->fl_owner = fl ? fl->fl_owner : NULL;
194
- __entry->fl_flags = fl ? fl->fl_flags : 0;
195
- __entry->fl_type = fl ? fl->fl_type : 0;
193
+ __entry->fl_owner = fl->fl_owner;
194
+ __entry->fl_flags = fl->fl_flags;
195
+ __entry->fl_type = fl->fl_type;
196196 ),
197197
198
- TP_printk("dev=0x%x:0x%x ino=0x%lx wcount=%d dcount=%d icount=%d fl_owner=0x%p fl_flags=%s fl_type=%s",
198
+ TP_printk("dev=0x%x:0x%x ino=0x%lx wcount=%d rcount=%d icount=%d fl_owner=%p fl_flags=%s fl_type=%s",
199199 MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
200
- __entry->i_ino, __entry->wcount, __entry->dcount,
200
+ __entry->i_ino, __entry->wcount, __entry->rcount,
201201 __entry->icount, __entry->fl_owner,
202202 show_fl_flags(__entry->fl_flags),
203203 show_fl_type(__entry->fl_type))
204204 );
205205
206
+TRACE_EVENT(leases_conflict,
207
+ TP_PROTO(bool conflict, struct file_lock *lease, struct file_lock *breaker),
208
+
209
+ TP_ARGS(conflict, lease, breaker),
210
+
211
+ TP_STRUCT__entry(
212
+ __field(void *, lease)
213
+ __field(void *, breaker)
214
+ __field(unsigned int, l_fl_flags)
215
+ __field(unsigned int, b_fl_flags)
216
+ __field(unsigned char, l_fl_type)
217
+ __field(unsigned char, b_fl_type)
218
+ __field(bool, conflict)
219
+ ),
220
+
221
+ TP_fast_assign(
222
+ __entry->lease = lease;
223
+ __entry->l_fl_flags = lease->fl_flags;
224
+ __entry->l_fl_type = lease->fl_type;
225
+ __entry->breaker = breaker;
226
+ __entry->b_fl_flags = breaker->fl_flags;
227
+ __entry->b_fl_type = breaker->fl_type;
228
+ __entry->conflict = conflict;
229
+ ),
230
+
231
+ TP_printk("conflict %d: lease=%p fl_flags=%s fl_type=%s; breaker=%p fl_flags=%s fl_type=%s",
232
+ __entry->conflict,
233
+ __entry->lease,
234
+ show_fl_flags(__entry->l_fl_flags),
235
+ show_fl_type(__entry->l_fl_type),
236
+ __entry->breaker,
237
+ show_fl_flags(__entry->b_fl_flags),
238
+ show_fl_type(__entry->b_fl_type))
239
+);
240
+
206241 #endif /* _TRACE_FILELOCK_H */
207242
208243 /* This part must be outside protection */