You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
locks: sprinkle some tracepoints around the file locking code
Add some tracepoints around the POSIX locking code. These were useful when tracking down problems when handling the race between setlk and close. Signed-off-by: Jeff Layton <jeff.layton@primarydata.com> Acked-by: "J. Bruce Fields" <bfields@fieldses.org>
This commit is contained in:
@@ -34,6 +34,83 @@
|
||||
{ F_WRLCK, "F_WRLCK" }, \
|
||||
{ F_UNLCK, "F_UNLCK" })
|
||||
|
||||
TRACE_EVENT(locks_get_lock_context,
|
||||
TP_PROTO(struct inode *inode, int type, struct file_lock_context *ctx),
|
||||
|
||||
TP_ARGS(inode, type, ctx),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field(unsigned long, i_ino)
|
||||
__field(dev_t, s_dev)
|
||||
__field(unsigned char, type)
|
||||
__field(struct file_lock_context *, ctx)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->s_dev = inode->i_sb->s_dev;
|
||||
__entry->i_ino = inode->i_ino;
|
||||
__entry->type = type;
|
||||
__entry->ctx = ctx;
|
||||
),
|
||||
|
||||
TP_printk("dev=0x%x:0x%x ino=0x%lx type=%s ctx=%p",
|
||||
MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
|
||||
__entry->i_ino, show_fl_type(__entry->type), __entry->ctx)
|
||||
);
|
||||
|
||||
DECLARE_EVENT_CLASS(filelock_lock,
|
||||
TP_PROTO(struct inode *inode, struct file_lock *fl, int ret),
|
||||
|
||||
TP_ARGS(inode, fl, ret),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field(struct file_lock *, fl)
|
||||
__field(unsigned long, i_ino)
|
||||
__field(dev_t, s_dev)
|
||||
__field(struct file_lock *, fl_next)
|
||||
__field(fl_owner_t, fl_owner)
|
||||
__field(unsigned int, fl_pid)
|
||||
__field(unsigned int, fl_flags)
|
||||
__field(unsigned char, fl_type)
|
||||
__field(loff_t, fl_start)
|
||||
__field(loff_t, fl_end)
|
||||
__field(int, ret)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->fl = fl ? fl : NULL;
|
||||
__entry->s_dev = inode->i_sb->s_dev;
|
||||
__entry->i_ino = inode->i_ino;
|
||||
__entry->fl_next = fl ? fl->fl_next : NULL;
|
||||
__entry->fl_owner = fl ? fl->fl_owner : NULL;
|
||||
__entry->fl_pid = fl ? fl->fl_pid : 0;
|
||||
__entry->fl_flags = fl ? fl->fl_flags : 0;
|
||||
__entry->fl_type = fl ? fl->fl_type : 0;
|
||||
__entry->fl_start = fl ? fl->fl_start : 0;
|
||||
__entry->fl_end = fl ? fl->fl_end : 0;
|
||||
__entry->ret = ret;
|
||||
),
|
||||
|
||||
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",
|
||||
__entry->fl, MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
|
||||
__entry->i_ino, __entry->fl_next, __entry->fl_owner,
|
||||
__entry->fl_pid, show_fl_flags(__entry->fl_flags),
|
||||
show_fl_type(__entry->fl_type),
|
||||
__entry->fl_start, __entry->fl_end, __entry->ret)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(filelock_lock, posix_lock_inode,
|
||||
TP_PROTO(struct inode *inode, struct file_lock *fl, int ret),
|
||||
TP_ARGS(inode, fl, ret));
|
||||
|
||||
DEFINE_EVENT(filelock_lock, fcntl_setlk,
|
||||
TP_PROTO(struct inode *inode, struct file_lock *fl, int ret),
|
||||
TP_ARGS(inode, fl, ret));
|
||||
|
||||
DEFINE_EVENT(filelock_lock, locks_remove_posix,
|
||||
TP_PROTO(struct inode *inode, struct file_lock *fl, int ret),
|
||||
TP_ARGS(inode, fl, ret));
|
||||
|
||||
DECLARE_EVENT_CLASS(filelock_lease,
|
||||
|
||||
TP_PROTO(struct inode *inode, struct file_lock *fl),
|
||||
|
||||
Reference in New Issue
Block a user