2 * Events for filesystem locks
4 * Copyright 2013 Jeff Layton <jlayton@poochiereds.net>
7 #define TRACE_SYSTEM filelock
9 #if !defined(_TRACE_FILELOCK_H) || defined(TRACE_HEADER_MULTI_READ)
10 #define _TRACE_FILELOCK_H
12 #include <linux/tracepoint.h>
14 #include <linux/device.h>
15 #include <linux/kdev_t.h>
17 #define show_fl_flags(val) \
18 __print_flags(val, "|", \
19 { FL_POSIX, "FL_POSIX" }, \
20 { FL_FLOCK, "FL_FLOCK" }, \
21 { FL_DELEG, "FL_DELEG" }, \
22 { FL_ACCESS, "FL_ACCESS" }, \
23 { FL_EXISTS, "FL_EXISTS" }, \
24 { FL_LEASE, "FL_LEASE" }, \
25 { FL_CLOSE, "FL_CLOSE" }, \
26 { FL_SLEEP, "FL_SLEEP" }, \
27 { FL_DOWNGRADE_PENDING, "FL_DOWNGRADE_PENDING" }, \
28 { FL_UNLOCK_PENDING, "FL_UNLOCK_PENDING" }, \
29 { FL_OFDLCK, "FL_OFDLCK" })
31 #define show_fl_type(val) \
32 __print_symbolic(val, \
33 { F_RDLCK, "F_RDLCK" }, \
34 { F_WRLCK, "F_WRLCK" }, \
35 { F_UNLCK, "F_UNLCK" })
37 DECLARE_EVENT_CLASS(filelock_lease
,
39 TP_PROTO(struct inode
*inode
, struct file_lock
*fl
),
44 __field(struct file_lock
*, fl
)
45 __field(unsigned long, i_ino
)
47 __field(struct file_lock
*, fl_next
)
48 __field(fl_owner_t
, fl_owner
)
49 __field(unsigned int, fl_flags
)
50 __field(unsigned char, fl_type
)
51 __field(unsigned long, fl_break_time
)
52 __field(unsigned long, fl_downgrade_time
)
56 __entry
->fl
= fl
? fl
: NULL
;
57 __entry
->s_dev
= inode
->i_sb
->s_dev
;
58 __entry
->i_ino
= inode
->i_ino
;
59 __entry
->fl_next
= fl
? fl
->fl_next
: NULL
;
60 __entry
->fl_owner
= fl
? fl
->fl_owner
: NULL
;
61 __entry
->fl_flags
= fl
? fl
->fl_flags
: 0;
62 __entry
->fl_type
= fl
? fl
->fl_type
: 0;
63 __entry
->fl_break_time
= fl
? fl
->fl_break_time
: 0;
64 __entry
->fl_downgrade_time
= fl
? fl
->fl_downgrade_time
: 0;
67 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",
68 __entry
->fl
, MAJOR(__entry
->s_dev
), MINOR(__entry
->s_dev
),
69 __entry
->i_ino
, __entry
->fl_next
, __entry
->fl_owner
,
70 show_fl_flags(__entry
->fl_flags
),
71 show_fl_type(__entry
->fl_type
),
72 __entry
->fl_break_time
, __entry
->fl_downgrade_time
)
75 DEFINE_EVENT(filelock_lease
, break_lease_noblock
, TP_PROTO(struct inode
*inode
, struct file_lock
*fl
),
78 DEFINE_EVENT(filelock_lease
, break_lease_block
, TP_PROTO(struct inode
*inode
, struct file_lock
*fl
),
81 DEFINE_EVENT(filelock_lease
, break_lease_unblock
, TP_PROTO(struct inode
*inode
, struct file_lock
*fl
),
84 DEFINE_EVENT(filelock_lease
, generic_add_lease
, TP_PROTO(struct inode
*inode
, struct file_lock
*fl
),
87 DEFINE_EVENT(filelock_lease
, generic_delete_lease
, TP_PROTO(struct inode
*inode
, struct file_lock
*fl
),
90 DEFINE_EVENT(filelock_lease
, time_out_leases
, TP_PROTO(struct inode
*inode
, struct file_lock
*fl
),
93 #endif /* _TRACE_FILELOCK_H */
95 /* This part must be outside protection */
96 #include <trace/define_trace.h>