From: chenggang.qin@gmail.com
To: linux-kernel@vger.kernel.org
Cc: chenggang <chenggang.qcg@alibaba-inc.com>,
Steven Rostedt <rostedt@goodmis.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@redhat.com>
Subject: [PATCH] Tracepoint: Add 'file name' as a parameter of tracepoint events ext4:ext4_direct_IO_enter&ext4:ext4_direct_IO_exit
Date: Fri, 1 Feb 2013 23:37:38 +0800 [thread overview]
Message-ID: <510be15d.29bf440a.56c6.ffffb82e@mx.google.com> (raw)
In-Reply-To: <y>
From: chenggang <chenggang.qcg@alibaba-inc.com>
Yesterday, I implemented these tracepoint events in VFS subsystem.
It is not a good idea.
Now, I modified two existing tracepoint events in ext4 subsystem to implement
the same function.
Many database systems use their own page cache subsystems and use the direct IO
to access the disks. Sometimes, the system engineers want to know the misses
rate of the database system's page cache. They also require to know what files
are accessed by the target processes with the direct IO method. These requirements
can be satisfied by recording the database's file access behavior through the way
of direct IO. So, we add 'file name' as a parameter of tracepoint events:
ext4:ext4_direct_IO_enter & ext4:ext4_direct_IO_exit.
Then, we will extend the perf or blktrace's function to use these tracepoint events.
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Chenggang Qin <chenggang.qcg@alibaba-inc.com>
---
fs/ext4/inode.c | 7 +++++--
include/trace/events/ext4.h | 22 ++++++++++++++--------
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index cbfe13b..92a379f 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3202,6 +3202,7 @@ static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb,
struct file *file = iocb->ki_filp;
struct inode *inode = file->f_mapping->host;
ssize_t ret;
+ const unsigned char *fname;
/*
* If we are doing data journalling we don't support O_DIRECT
@@ -3213,13 +3214,15 @@ static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb,
if (ext4_has_inline_data(inode))
return 0;
- trace_ext4_direct_IO_enter(inode, offset, iov_length(iov, nr_segs), rw);
+ fname = file->f_path.dentry->d_name.name;
+ trace_ext4_direct_IO_enter(inode, offset, iov_length(iov, nr_segs), rw,
+ fname);
if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
ret = ext4_ext_direct_IO(rw, iocb, iov, offset, nr_segs);
else
ret = ext4_ind_direct_IO(rw, iocb, iov, offset, nr_segs);
trace_ext4_direct_IO_exit(inode, offset,
- iov_length(iov, nr_segs), rw, ret);
+ iov_length(iov, nr_segs), rw, ret, fname);
return ret;
}
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 7e8c36b..532bbb4 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -1211,9 +1211,10 @@ DEFINE_EVENT(ext4__bitmap_load, ext4_load_inode_bitmap,
);
TRACE_EVENT(ext4_direct_IO_enter,
- TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw),
+ TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw,
+ const unsigned char *fname),
- TP_ARGS(inode, offset, len, rw),
+ TP_ARGS(inode, offset, len, rw, fname),
TP_STRUCT__entry(
__field( dev_t, dev )
@@ -1221,6 +1222,7 @@ TRACE_EVENT(ext4_direct_IO_enter,
__field( loff_t, pos )
__field( unsigned long, len )
__field( int, rw )
+ __string( fname, fname )
),
TP_fast_assign(
@@ -1229,19 +1231,20 @@ TRACE_EVENT(ext4_direct_IO_enter,
__entry->pos = offset;
__entry->len = len;
__entry->rw = rw;
+ __assign_str(fname, fname);
),
- TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d",
+ TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d fname %s",
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long) __entry->ino,
- __entry->pos, __entry->len, __entry->rw)
+ __entry->pos, __entry->len, __entry->rw, __get_str(fname))
);
TRACE_EVENT(ext4_direct_IO_exit,
TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
- int rw, int ret),
+ int rw, int ret, const unsigned char *fname),
- TP_ARGS(inode, offset, len, rw, ret),
+ TP_ARGS(inode, offset, len, rw, ret, fname),
TP_STRUCT__entry(
__field( dev_t, dev )
@@ -1250,6 +1253,7 @@ TRACE_EVENT(ext4_direct_IO_exit,
__field( unsigned long, len )
__field( int, rw )
__field( int, ret )
+ __string( fname, fname )
),
TP_fast_assign(
@@ -1259,13 +1263,15 @@ TRACE_EVENT(ext4_direct_IO_exit,
__entry->len = len;
__entry->rw = rw;
__entry->ret = ret;
+ __assign_str(fname, fname);
),
- TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d ret %d",
+ TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d ret %d fname %s",
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long) __entry->ino,
__entry->pos, __entry->len,
- __entry->rw, __entry->ret)
+ __entry->rw, __entry->ret,
+ __get_str(fname))
);
TRACE_EVENT(ext4_fallocate_enter,
--
1.7.9.5
next reply other threads:[~2013-02-01 15:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-01 15:37 chenggang.qin [this message]
2013-02-01 16:26 ` [PATCH] Tracepoint: Add 'file name' as a parameter of tracepoint events ext4:ext4_direct_IO_enter&ext4:ext4_direct_IO_exit Theodore Ts'o
2013-02-01 19:34 ` Al Viro
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=510be15d.29bf440a.56c6.ffffb82e@mx.google.com \
--to=chenggang.qin@gmail.com \
--cc=chenggang.qcg@alibaba-inc.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
/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