Advertisement
Guest User

ureadahead-2.6.36-trace-patch

a guest
Oct 23rd, 2010
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.35 KB | None | 0 0
  1. From ee9c0b591bf16ca11bb354bc68dae75a903f3a64 Mon Sep 17 00:00:00 2001
  2. From: Scott James Remnant <scott@ubuntu.com>
  3. Date: Tue, 27 Oct 2009 10:05:32 +0000
  4. Subject: [PATCH] trace: add trace events for open(), exec() and uselib()
  5.  
  6. This patch uses TRACE_EVENT to add tracepoints for the open(),
  7. exec() and uselib() syscalls so that ureadahead can cheaply trace
  8. the boot sequence to determine what to read to speed up the next.
  9.  
  10. It's not upstream because it will need to be rebased onto the syscall
  11. trace events whenever that gets merged, and is a stop-gap.
  12.  
  13. Signed-off-by: Scott James Remnant <scott@ubuntu.com>
  14. ---
  15. fs/exec.c | 4 +++++
  16. fs/open.c | 4 ++
  17. include/trace/events/fs.h | 71 +++++++++++++++++++++++++++++++++++++++++++++
  18. 3 files changed, 79 insertions(+), 0 deletions(-)
  19. create mode 100644 include/trace/events/fs.h
  20.  
  21. diff --git a/fs/exec.c b/fs/exec.c
  22. index 172ceb6..c936999 100644
  23. --- a/fs/exec.c
  24. +++ b/fs/exec.c
  25. @@ -55,6 +55,8 @@
  26. #include <linux/fs_struct.h>
  27. #include <linux/pipe_fs_i.h>
  28.  
  29. +#include <trace/events/fs.h>
  30. +
  31. #include <asm/uaccess.h>
  32. #include <asm/mmu_context.h>
  33. #include <asm/tlb.h>
  34.  
  35. @@ -700,6 +702,8 @@ struct file *open_exec(const char *name)
  36.  
  37. fsnotify_open(file);
  38.  
  39. + trace_open_exec(name);
  40. +
  41. err = deny_write_access(file);
  42. if (err)
  43. goto exit;
  44. diff --git a/fs/open.c b/fs/open.c
  45. index 04b9aad..41c87f3 100644
  46. --- a/fs/open.c
  47. +++ b/fs/open.c
  48. @@ -33,6 +33,9 @@
  49.  
  50. #include "internal.h"
  51.  
  52. +#define CREATE_TRACE_POINTS
  53. +#include <trace/events/fs.h>
  54. +
  55. int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
  56. struct file *filp)
  57. {
  58. @@ -890,6 +893,7 @@ long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
  59. } else {
  60. fsnotify_open(f);
  61. fd_install(fd, f);
  62. + trace_do_sys_open(tmp, flags, mode);
  63. }
  64. }
  65. putname(tmp);
  66. diff --git a/include/trace/events/fs.h b/include/trace/events/fs.h
  67. new file mode 100644
  68. index 0000000..e967c55
  69. --- /dev/null
  70. +++ b/include/trace/events/fs.h
  71. @@ -0,0 +1,71 @@
  72. +#undef TRACE_SYSTEM
  73. +#define TRACE_SYSTEM fs
  74. +
  75. +#if !defined(_TRACE_FS_H) || defined(TRACE_HEADER_MULTI_READ)
  76. +#define _TRACE_FS_H
  77. +
  78. +#include <linux/fs.h>
  79. +#include <linux/tracepoint.h>
  80. +
  81. +TRACE_EVENT(do_sys_open,
  82. +
  83. + TP_PROTO(char *filename, int flags, int mode),
  84. +
  85. + TP_ARGS(filename, flags, mode),
  86. +
  87. + TP_STRUCT__entry(
  88. + __string( filename, filename )
  89. + __field( int, flags )
  90. + __field( int, mode )
  91. + ),
  92. +
  93. + TP_fast_assign(
  94. + __assign_str(filename, filename);
  95. + __entry->flags = flags;
  96. + __entry->mode = mode;
  97. + ),
  98. +
  99. + TP_printk("\"%s\" %x %o",
  100. + __get_str(filename), __entry->flags, __entry->mode)
  101. +);
  102. +
  103. +TRACE_EVENT(uselib,
  104. +
  105. + TP_PROTO(char *filename),
  106. +
  107. + TP_ARGS(filename),
  108. +
  109. + TP_STRUCT__entry(
  110. + __string( filename, filename )
  111. + ),
  112. +
  113. + TP_fast_assign(
  114. + __assign_str(filename, filename);
  115. + ),
  116. +
  117. + TP_printk("\"%s\"",
  118. + __get_str(filename))
  119. +);
  120. +
  121. +TRACE_EVENT(open_exec,
  122. +
  123. + TP_PROTO(char *filename),
  124. +
  125. + TP_ARGS(filename),
  126. +
  127. + TP_STRUCT__entry(
  128. + __string( filename, filename )
  129. + ),
  130. +
  131. + TP_fast_assign(
  132. + __assign_str(filename, filename);
  133. + ),
  134. +
  135. + TP_printk("\"%s\"",
  136. + __get_str(filename))
  137. +);
  138. +
  139. +#endif /* _TRACE_FS_H */
  140. +
  141. +/* This part must be outside protection */
  142. +#include <trace/define_trace.h>
  143. --
  144. 1.6.3.3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement