From 5c0b22e36347ea84437d6d2d9e554e032b2e7a0c Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Tue, 27 Oct 2009 10:05:32 +0000 Subject: [PATCH] UBUNTU: SAUCE: (no-up) trace: add trace events for open(), exec() and uselib() BugLink: http://bugs.launchpad.net/bugs/462111 This patch uses TRACE_EVENT to add tracepoints for the open(), exec() and uselib() syscalls so that ureadahead can cheaply trace the boot sequence to determine what to read to speed up the next. It's not upstream because it will need to be rebased onto the syscall trace events whenever that gets merged, and is a stop-gap. Signed-off-by: Scott James Remnant Acked-by: Stefan Bader Acked-by: Andy Whitcroft Signed-off-by: Stefan Bader --- fs/exec.c | 4 ++++ fs/open.c | 4 ++++ include/trace/events/fs.h | 53 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 include/trace/events/fs.h diff --git a/fs/exec.c b/fs/exec.c index 52a447d..9cfbbd8 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -56,6 +56,8 @@ #include #include +#include + #include #include #include @@ -737,6 +739,8 @@ struct file *open_exec(const char *name) fsnotify_open(file); + trace_open_exec(name); + err = deny_write_access(file); if (err) goto exit; diff --git a/fs/open.c b/fs/open.c index b47aab3..425837c 100644 --- a/fs/open.c +++ b/fs/open.c @@ -33,6 +33,9 @@ #include "internal.h" +#define CREATE_TRACE_POINTS +#include + int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs, struct file *filp) { @@ -905,6 +908,7 @@ long do_sys_open(int dfd, const char __user *filename, int flags, int mode) } else { fsnotify_open(f); fd_install(fd, f); + trace_do_sys_open(tmp, flags, mode); } } putname(tmp); diff --git a/include/trace/events/fs.h b/include/trace/events/fs.h new file mode 100644 index 0000000..2cbb8fe --- /dev/null +++ b/include/trace/events/fs.h @@ -0,0 +1,53 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM fs + +#if !defined(_TRACE_FS_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_FS_H + +#include +#include + +TRACE_EVENT(do_sys_open, + + TP_PROTO(char *filename, int flags, int mode), + + TP_ARGS(filename, flags, mode), + + TP_STRUCT__entry( + __string( filename, filename ) + __field( int, flags ) + __field( int, mode ) + ), + + TP_fast_assign( + __assign_str(filename, filename); + __entry->flags = flags; + __entry->mode = mode; + ), + + TP_printk("\"%s\" %x %o", + __get_str(filename), __entry->flags, __entry->mode) +); + +TRACE_EVENT(open_exec, + + TP_PROTO(char *filename), + + TP_ARGS(filename), + + TP_STRUCT__entry( + __string( filename, filename ) + ), + + TP_fast_assign( + __assign_str(filename, filename); + ), + + TP_printk("\"%s\"", + __get_str(filename)) +); + +#endif /* _TRACE_FS_H */ + +/* This part must be outside protection */ +#include -- 1.7.10.4