On Thu 16-04-26 10:35:06, Jeff Layton wrote: > Add a tracepoint so we can see exactly how this is being called. > > Signed-off-by: Jeff Layton <[email protected]>
Looks good. Feel free to add: Reviewed-by: Jan Kara <[email protected]> Honza > --- > fs/notify/fsnotify.c | 5 ++++ > include/trace/events/fsnotify.h | 51 > +++++++++++++++++++++++++++++++++++++++++ > include/trace/misc/fsnotify.h | 35 ++++++++++++++++++++++++++++ > 3 files changed, 91 insertions(+) > > diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c > index 9995de1710e5..5448738635f6 100644 > --- a/fs/notify/fsnotify.c > +++ b/fs/notify/fsnotify.c > @@ -14,6 +14,9 @@ > #include <linux/fsnotify_backend.h> > #include "fsnotify.h" > > +#define CREATE_TRACE_POINTS > +#include <trace/events/fsnotify.h> > + > /* > * Clear all of the marks on an inode when it is being evicted from core > */ > @@ -504,6 +507,8 @@ int fsnotify(__u32 mask, const void *data, int data_type, > struct inode *dir, > int ret = 0; > __u32 test_mask, marks_mask = 0; > > + trace_fsnotify(mask, data, data_type, dir, file_name, inode, cookie); > + > if (path) > mnt = real_mount(path->mnt); > > diff --git a/include/trace/events/fsnotify.h b/include/trace/events/fsnotify.h > new file mode 100644 > index 000000000000..341bbd57a39b > --- /dev/null > +++ b/include/trace/events/fsnotify.h > @@ -0,0 +1,51 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +#undef TRACE_SYSTEM > +#define TRACE_SYSTEM fsnotify > + > +#if !defined(_TRACE_FSNOTIFY_H) || defined(TRACE_HEADER_MULTI_READ) > +#define _TRACE_FSNOTIFY_H > + > +#include <linux/tracepoint.h> > + > +#include <trace/misc/fsnotify.h> > + > +TRACE_EVENT(fsnotify, > + TP_PROTO(__u32 mask, const void *data, int data_type, > + struct inode *dir, const struct qstr *file_name, > + struct inode *inode, u32 cookie), > + > + TP_ARGS(mask, data, data_type, dir, file_name, inode, cookie), > + > + TP_STRUCT__entry( > + __field(__u32, mask) > + __field(unsigned long, dir_ino) > + __field(unsigned long, ino) > + __field(dev_t, s_dev) > + __field(int, data_type) > + __field(u32, cookie) > + __string(file_name, file_name ? (const char *)file_name->name : > "") > + ), > + > + TP_fast_assign( > + __entry->mask = mask; > + __entry->dir_ino = dir ? dir->i_ino : 0; > + __entry->ino = inode ? inode->i_ino : 0; > + __entry->s_dev = dir ? dir->i_sb->s_dev : > + inode ? inode->i_sb->s_dev : 0; > + __entry->data_type = data_type; > + __entry->cookie = cookie; > + __assign_str(file_name); > + ), > + > + TP_printk("dev=%d:%d dir=%lu ino=%lu data_type=%d cookie=0x%x mask=0x%x > %s name=%s", > + MAJOR(__entry->s_dev), MINOR(__entry->s_dev), > + __entry->dir_ino, __entry->ino, > + __entry->data_type, __entry->cookie, > + __entry->mask, show_fsnotify_mask(__entry->mask), > + __get_str(file_name)) > +); > + > +#endif /* _TRACE_FSNOTIFY_H */ > + > +/* This part must be outside protection */ > +#include <trace/define_trace.h> > diff --git a/include/trace/misc/fsnotify.h b/include/trace/misc/fsnotify.h > new file mode 100644 > index 000000000000..a201e1bd6d8c > --- /dev/null > +++ b/include/trace/misc/fsnotify.h > @@ -0,0 +1,35 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* > + * Display helpers for fsnotify events > + */ > + > +#include <linux/fsnotify_backend.h> > + > +#define show_fsnotify_mask(mask) \ > + __print_flags(mask, "|", \ > + { FS_ACCESS, "ACCESS" }, \ > + { FS_MODIFY, "MODIFY" }, \ > + { FS_ATTRIB, "ATTRIB" }, \ > + { FS_CLOSE_WRITE, "CLOSE_WRITE" }, \ > + { FS_CLOSE_NOWRITE, "CLOSE_NOWRITE" }, \ > + { FS_OPEN, "OPEN" }, \ > + { FS_MOVED_FROM, "MOVED_FROM" }, \ > + { FS_MOVED_TO, "MOVED_TO" }, \ > + { FS_CREATE, "CREATE" }, \ > + { FS_DELETE, "DELETE" }, \ > + { FS_DELETE_SELF, "DELETE_SELF" }, \ > + { FS_MOVE_SELF, "MOVE_SELF" }, \ > + { FS_OPEN_EXEC, "OPEN_EXEC" }, \ > + { FS_UNMOUNT, "UNMOUNT" }, \ > + { FS_Q_OVERFLOW, "Q_OVERFLOW" }, \ > + { FS_ERROR, "ERROR" }, \ > + { FS_OPEN_PERM, "OPEN_PERM" }, \ > + { FS_ACCESS_PERM, "ACCESS_PERM" }, \ > + { FS_OPEN_EXEC_PERM, "OPEN_EXEC_PERM" }, \ > + { FS_PRE_ACCESS, "PRE_ACCESS" }, \ > + { FS_MNT_ATTACH, "MNT_ATTACH" }, \ > + { FS_MNT_DETACH, "MNT_DETACH" }, \ > + { FS_EVENT_ON_CHILD, "EVENT_ON_CHILD" }, \ > + { FS_RENAME, "RENAME" }, \ > + { FS_DN_MULTISHOT, "DN_MULTISHOT" }, \ > + { FS_ISDIR, "ISDIR" }) > > -- > 2.53.0 > -- Jan Kara <[email protected]> SUSE Labs, CR
