| From 355090ccb94ff35cc4571fb1e9ba7c267d01e5c7 Mon Sep 17 00:00:00 2001 |
| From: Scott James Remnant <scott@ubuntu.com> |
| Date: Tue, 27 Oct 2009 10:05:32 +0000 |
| Subject: [PATCH] UBUNTU: SAUCE: 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. |
| |
| [benzh: 3.14 rebase. Squashed 2 warning fixes. Fixed a new incompatible |
| pointer type error for trace_open_exec() due to upstream change] |
| |
| Change-Id: I3bb5c3f6c2b4b7cfbe7045e342092a4d652bcef2 |
| Signed-off-by: Scott James Remnant <scott@ubuntu.com> |
| Acked-by: Stefan Bader <stefan.bader@canonical.com> |
| Acked-by: Andy Whitcroft <andy.whitcroft@canonical.com> |
| Signed-off-by: Stefan Bader <stefan.bader@canonical.com> |
| Signed-off-by: Ben Zhang <benzh@chromium.org> |
| |
| Conflicts: |
| fs/exec.c |
| [rebase44(filbranden): Moved the trace_open_exec call to the block where |
| fsnotify_open was.] |
| Signed-off-by: Filipe Brandenburger <filbranden@chromium.org> |
| |
| Conflicts: |
| fs/open.c |
| fs/exec.c |
| |
| [rebase412(groeck): Resolved conflicts] |
| Signed-off-by: Guenter Roeck <groeck@chromium.org> |
| [rebase510(groeck): Context conflicts (open syscalls rearranged)] |
| Signed-off-by: Guenter Roeck <groeck@chromium.org> |
| Change-Id: I81ae7cf6bc8e435829666fdf21d13c7fd2c5eba5 |
| --- |
| fs/exec.c | 6 ++++- |
| fs/open.c | 4 +++ |
| include/trace/events/fs.h | 53 +++++++++++++++++++++++++++++++++++++++ |
| 3 files changed, 62 insertions(+), 1 deletion(-) |
| create mode 100644 include/trace/events/fs.h |
| |
| diff --git a/fs/exec.c b/fs/exec.c |
| index 18594f11c31f..4ea4147ee31b 100644 |
| --- a/fs/exec.c |
| +++ b/fs/exec.c |
| @@ -70,6 +70,7 @@ |
| #include <asm/mmu_context.h> |
| #include <asm/tlb.h> |
| |
| +#include <trace/events/fs.h> |
| #include <trace/events/task.h> |
| #include "internal.h" |
| |
| @@ -928,9 +929,12 @@ static struct file *do_open_execat(int fd, struct filename *name, int flags) |
| if (err) |
| goto exit; |
| |
| - if (name->name[0] != '\0') |
| + if (name->name[0] != '\0') { |
| fsnotify_open(file); |
| |
| + trace_open_exec(name->name); |
| + } |
| + |
| out: |
| return file; |
| |
| diff --git a/fs/open.c b/fs/open.c |
| index e53af13b5835..02686cc31be1 100644 |
| --- a/fs/open.c |
| +++ b/fs/open.c |
| @@ -35,6 +35,9 @@ |
| |
| #include "internal.h" |
| |
| +#define CREATE_TRACE_POINTS |
| +#include <trace/events/fs.h> |
| + |
| int do_truncate(struct user_namespace *mnt_userns, struct dentry *dentry, |
| loff_t length, unsigned int time_attrs, struct file *filp) |
| { |
| @@ -1191,6 +1194,7 @@ static long do_sys_openat2(int dfd, const char __user *filename, |
| } else { |
| fsnotify_open(f); |
| fd_install(fd, f); |
| + trace_do_sys_open(tmp->name, how->flags, how->mode); |
| } |
| } |
| putname(tmp); |
| diff --git a/include/trace/events/fs.h b/include/trace/events/fs.h |
| new file mode 100644 |
| index 000000000000..fb634b74adf3 |
| --- /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 <linux/fs.h> |
| +#include <linux/tracepoint.h> |
| + |
| +TRACE_EVENT(do_sys_open, |
| + |
| + TP_PROTO(const 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(const 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 <trace/define_trace.h> |
| -- |
| 2.17.1 |
| |