]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
UBUNTU: SAUCE: (no-up) trace: add trace events for open(), exec() and uselib() (for...
authorScott James Remnant <scott@ubuntu.com>
Tue, 27 Oct 2009 10:05:32 +0000 (10:05 +0000)
committerSeth Forshee <seth.forshee@canonical.com>
Tue, 5 Sep 2017 12:32:55 +0000 (07:32 -0500)
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.

[apw@canonical.com: updated for v3.7 and later.]
[apw@canonical.com: updated for v3.19 and later.]
BugLink: http://bugs.launchpad.net/bugs/1085766
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>
Conflicts:

fs/open.c

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
fs/exec.c
fs/open.c
include/trace/events/fs.h [new file with mode: 0644]

index 62175cbcc80171df25da8e8bdd07547c83515b06..9342e61c5fbb629b06380ff7cc33212b9edf63dc 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -63,6 +63,8 @@
 #include <linux/compat.h>
 #include <linux/vmalloc.h>
 
+#include <trace/events/fs.h>
+
 #include <linux/uaccess.h>
 #include <asm/mmu_context.h>
 #include <asm/tlb.h>
@@ -864,6 +866,8 @@ static struct file *do_open_execat(int fd, struct filename *name, int flags)
        if (name->name[0] != '\0')
                fsnotify_open(file);
 
+       trace_open_exec(name->name);
+
 out:
        return file;
 
index 35bb784763a4fde35558b10d8538cb9617a7c728..d8dc52ad435c1f062db28aaf87e55a90428491b6 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -34,6 +34,9 @@
 
 #include "internal.h"
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/fs.h>
+
 int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
        struct file *filp)
 {
@@ -1063,6 +1066,7 @@ long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode)
                } else {
                        fsnotify_open(f);
                        fd_install(fd, f);
+                       trace_do_sys_open(tmp->name, flags, mode);
                }
        }
        putname(tmp);
diff --git a/include/trace/events/fs.h b/include/trace/events/fs.h
new file mode 100644 (file)
index 0000000..fb634b7
--- /dev/null
@@ -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>