From: Tejun Heo <tj@kernel.org>
To: axboe@kernel.dk, mingo@redhat.com, rostedt@goodmis.org,
fweisbec@gmail.com, teravest@google.com, slavapestov@google.com,
ctalbott@google.com, dsharp@google.com
Cc: linux-kernel@vger.kernel.org, Tejun Heo <tj@kernel.org>
Subject: [PATCH 09/11] vfs: add fcheck tracepoint
Date: Thu, 5 Jan 2012 15:42:52 -0800 [thread overview]
Message-ID: <1325806974-23486-10-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1325806974-23486-1-git-send-email-tj@kernel.org>
All file accesses from userland go through fcheck to map fd to struct
file, making it a very good location for peeking at what files
userland is accessing. Add a tracepoint there.
This is part of tracepoint additions to improve visiblity into
dirtying / writeback operations for io tracer and userland.
Signed-off-by: Tejun Heo <tj@kernel.org>
---
fs/super.c | 2 ++
include/linux/fdtable.h | 3 +++
include/trace/events/vfs.h | 40 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 45 insertions(+), 0 deletions(-)
create mode 100644 include/trace/events/vfs.h
diff --git a/fs/super.c b/fs/super.c
index afd0f1a..7b70a2e 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -34,6 +34,8 @@
#include <linux/cleancache.h>
#include "internal.h"
+#define CREATE_TRACE_POINTS
+#include <trace/events/vfs.h>
LIST_HEAD(super_blocks);
DEFINE_SPINLOCK(sb_lock);
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index 82163c4..72df04b 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -12,6 +12,7 @@
#include <linux/types.h>
#include <linux/init.h>
#include <linux/fs.h>
+#include <trace/events/vfs.h>
#include <linux/atomic.h>
@@ -87,6 +88,8 @@ static inline struct file * fcheck_files(struct files_struct *files, unsigned in
if (fd < fdt->max_fds)
file = rcu_dereference_check_fdtable(files, fdt->fd[fd]);
+
+ trace_vfs_fcheck(files, fd, file);
return file;
}
diff --git a/include/trace/events/vfs.h b/include/trace/events/vfs.h
new file mode 100644
index 0000000..9a9bae4
--- /dev/null
+++ b/include/trace/events/vfs.h
@@ -0,0 +1,40 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM vfs
+
+#if !defined(_TRACE_VFS_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_VFS_H
+
+#include <linux/tracepoint.h>
+#include <linux/fs.h>
+
+TRACE_EVENT(vfs_fcheck,
+
+ TP_PROTO(struct files_struct *files, unsigned int fd,
+ struct file *file),
+
+ TP_ARGS(files, fd, file),
+
+ TP_STRUCT__entry(
+ __field(unsigned int, fd)
+ __field(umode_t, mode)
+ __field(dev_t, dev)
+ __field(ino_t, ino)
+ ),
+
+ TP_fast_assign(
+ __entry->fd = fd;
+ __entry->mode = file ? file->f_path.dentry->d_inode->i_mode : 0;
+ __entry->dev = file ? file->f_path.dentry->d_inode->i_sb->s_dev : 0;
+ __entry->ino = file ? file->f_path.dentry->d_inode->i_ino : 0;
+ ),
+
+ TP_printk("fd %u mode 0x%x dev %d,%d ino %lu",
+ __entry->fd, __entry->mode,
+ MAJOR(__entry->dev), MINOR(__entry->dev),
+ (unsigned long)__entry->ino)
+);
+
+#endif /* _TRACE_VFS_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
--
1.7.3.1
next prev parent reply other threads:[~2012-01-05 23:44 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-05 23:42 [RFC PATCHSET RESEND] ioblame: statistical IO analyzer Tejun Heo
2012-01-05 23:42 ` [PATCH 01/11] trace_event_filter: factorize filter creation Tejun Heo
2012-01-05 23:42 ` [PATCH 02/11] trace_event_filter: add trace_event_filter_*() interface Tejun Heo
2012-01-05 23:42 ` [PATCH 03/11] block: block_bio_complete tracepoint was missing Tejun Heo
2012-01-09 1:30 ` Namhyung Kim
2012-01-09 1:49 ` Tejun Heo
2012-01-09 2:33 ` Namhyung Kim
2012-01-05 23:42 ` [PATCH 04/11] block: add @req to bio_{front|back}_merge tracepoints Tejun Heo
2012-01-05 23:42 ` [PATCH 05/11] block: abstract disk iteration into disk_iter Tejun Heo
2012-01-05 23:42 ` [PATCH 06/11] writeback: move struct wb_writeback_work to writeback.h Tejun Heo
2012-01-05 23:42 ` [PATCH 07/11] writeback: add more tracepoints Tejun Heo
2012-01-05 23:42 ` [PATCH 08/11] block: add block_touch_buffer tracepoint Tejun Heo
2012-01-05 23:42 ` Tejun Heo [this message]
2012-01-05 23:42 ` [PATCH 10/11] stacktrace: implement save_stack_trace_quick() Tejun Heo
2012-01-05 23:42 ` [PATCH 11/11] block, trace: implement ioblame IO statistical analyzer Tejun Heo
2012-01-06 9:00 ` [RFC PATCHSET RESEND] ioblame: statistical IO analyzer Namhyung Kim
2012-01-06 16:02 ` Tejun Heo
2012-01-06 16:33 ` Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1325806974-23486-10-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=axboe@kernel.dk \
--cc=ctalbott@google.com \
--cc=dsharp@google.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=slavapestov@google.com \
--cc=teravest@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome