1 /* 2 * Events for filesystem locks 3 * 4 * Copyright 2013 Jeff Layton <jlayton@poochiereds.net> 5 */ 6 #undef TRACE_SYSTEM 7 #define TRACE_SYSTEM filelock 8 9 #if !defined(_TRACE_FILELOCK_H) || defined(TRACE_HEADER_MULTI_READ) 10 #define _TRACE_FILELOCK_H 11 12 #include <linux/tracepoint.h> 13 #include <linux/fs.h> 14 #include <linux/device.h> 15 #include <linux/kdev_t.h> 16 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" }) 30 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" }) 36 37 DECLARE_EVENT_CLASS(filelock_lease, 38 39 TP_PROTO(struct inode *inode, struct file_lock *fl), 40 41 TP_ARGS(inode, fl), 42 43 TP_STRUCT__entry( 44 __field(struct file_lock *, fl) 45 __field(unsigned long, i_ino) 46 __field(dev_t, s_dev) 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) 53 ), 54 55 TP_fast_assign( 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; 65 ), 66 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) 73 ); 74 75 DEFINE_EVENT(filelock_lease, break_lease_noblock, TP_PROTO(struct inode *inode, struct file_lock *fl), 76 TP_ARGS(inode, fl)); 77 78 DEFINE_EVENT(filelock_lease, break_lease_block, TP_PROTO(struct inode *inode, struct file_lock *fl), 79 TP_ARGS(inode, fl)); 80 81 DEFINE_EVENT(filelock_lease, break_lease_unblock, TP_PROTO(struct inode *inode, struct file_lock *fl), 82 TP_ARGS(inode, fl)); 83 84 DEFINE_EVENT(filelock_lease, generic_add_lease, TP_PROTO(struct inode *inode, struct file_lock *fl), 85 TP_ARGS(inode, fl)); 86 87 DEFINE_EVENT(filelock_lease, generic_delete_lease, TP_PROTO(struct inode *inode, struct file_lock *fl), 88 TP_ARGS(inode, fl)); 89 90 DEFINE_EVENT(filelock_lease, time_out_leases, TP_PROTO(struct inode *inode, struct file_lock *fl), 91 TP_ARGS(inode, fl)); 92 93 #endif /* _TRACE_FILELOCK_H */ 94 95 /* This part must be outside protection */ 96 #include <trace/define_trace.h> 97