From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: cmm@us.ibm.com, tytso@mit.edu, sandeen@redhat.com
Cc: linux-ext4@vger.kernel.org,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Subject: [RFC PATCH 1/2] vfs: tracepoints for buffer flag updates
Date: Thu, 12 Nov 2009 00:00:59 +0530 [thread overview]
Message-ID: <1257964260-14020-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> (raw)
We collect the device details so that we can filter with device value
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
fs/buffer.c | 2 +
include/linux/buffer_head.h | 11 +++-
include/trace/events/buffer_head.h | 95 ++++++++++++++++++++++++++++++++++++
3 files changed, 106 insertions(+), 2 deletions(-)
create mode 100644 include/trace/events/buffer_head.h
diff --git a/fs/buffer.c b/fs/buffer.c
index 6fa5302..6f441aa 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -41,6 +41,8 @@
#include <linux/bitops.h>
#include <linux/mpage.h>
#include <linux/bit_spinlock.h>
+#define CREATE_TRACE_POINTS
+#include <trace/events/buffer_head.h>
static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 16ed028..1780701 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -13,6 +13,7 @@
#include <linux/pagemap.h>
#include <linux/wait.h>
#include <asm/atomic.h>
+#include <trace/events/buffer_head.h>
#ifdef CONFIG_BLOCK
@@ -84,10 +85,12 @@ struct buffer_head {
static inline void set_buffer_##name(struct buffer_head *bh) \
{ \
set_bit(BH_##bit, &(bh)->b_state); \
+ trace_set_buffer_##name(bh); \
} \
static inline void clear_buffer_##name(struct buffer_head *bh) \
{ \
clear_bit(BH_##bit, &(bh)->b_state); \
+ trace_clear_buffer_##name(bh); \
} \
static inline int buffer_##name(const struct buffer_head *bh) \
{ \
@@ -100,11 +103,15 @@ static inline int buffer_##name(const struct buffer_head *bh) \
#define TAS_BUFFER_FNS(bit, name) \
static inline int test_set_buffer_##name(struct buffer_head *bh) \
{ \
- return test_and_set_bit(BH_##bit, &(bh)->b_state); \
+ int ret = test_and_set_bit(BH_##bit, &(bh)->b_state); \
+ trace_set_buffer_##name(bh); \
+ return ret; \
} \
static inline int test_clear_buffer_##name(struct buffer_head *bh) \
{ \
- return test_and_clear_bit(BH_##bit, &(bh)->b_state); \
+ int ret = test_and_clear_bit(BH_##bit, &(bh)->b_state); \
+ trace_clear_buffer_##name(bh); \
+ return ret; \
} \
/*
diff --git a/include/trace/events/buffer_head.h b/include/trace/events/buffer_head.h
new file mode 100644
index 0000000..07605b5
--- /dev/null
+++ b/include/trace/events/buffer_head.h
@@ -0,0 +1,95 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM buffer_head
+
+#if !defined(_TRACE_BUFFER_HEAD_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_BUFFER_HEAD_H
+
+#include <linux/tracepoint.h>
+struct buffer_head;
+extern const char *jbd2_dev_to_name(dev_t device);
+
+
+#define BUFFER_HEAD_TRACE_EVENT(name) \
+TRACE_EVENT(set_buffer_##name, \
+ TP_PROTO(struct buffer_head *bh), \
+ \
+ TP_ARGS(bh), \
+ \
+ TP_STRUCT__entry( \
+ __field( void *, buffer ) \
+ __field( sector_t, block ) \
+ __field( unsigned long, state ) \
+ __field( dev_t, dev ) \
+ ), \
+ \
+ TP_fast_assign( \
+ __entry->buffer = bh; \
+ __entry->block = bh->b_blocknr; \
+ __entry->state = bh->b_state; \
+ if (bh->b_bdev) \
+ __entry->dev = disk_devt(bh->b_bdev->bd_disk); \
+ else \
+ __entry->dev = 0; \
+ ), \
+ \
+ TP_printk("bh = %p device = %s block = %llu new state = 0x%lx", \
+ __entry->buffer, jbd2_dev_to_name(__entry->dev), \
+ (unsigned long long) __entry->block, \
+ __entry->state) \
+); \
+ \
+TRACE_EVENT(clear_buffer_##name, \
+ TP_PROTO(struct buffer_head *bh), \
+ \
+ TP_ARGS(bh), \
+ \
+ TP_STRUCT__entry( \
+ __field( void *, buffer ) \
+ __field( sector_t, block ) \
+ __field( unsigned long, state ) \
+ __field( dev_t, dev ) \
+ ), \
+ \
+ TP_fast_assign( \
+ __entry->buffer = bh; \
+ __entry->block = bh->b_blocknr; \
+ __entry->state = bh->b_state; \
+ if (bh->b_bdev) \
+ __entry->dev = disk_devt(bh->b_bdev->bd_disk); \
+ else \
+ __entry->dev = 0; \
+ ), \
+ \
+ TP_printk("bh = %p device = %s block = %llu new state = 0x%lx", \
+ __entry->buffer, jbd2_dev_to_name(__entry->dev), \
+ (unsigned long long) __entry->block, \
+ __entry->state) \
+)
+
+BUFFER_HEAD_TRACE_EVENT(uptodate);
+BUFFER_HEAD_TRACE_EVENT(dirty);
+BUFFER_HEAD_TRACE_EVENT(locked);
+BUFFER_HEAD_TRACE_EVENT(req);
+BUFFER_HEAD_TRACE_EVENT(mapped);
+BUFFER_HEAD_TRACE_EVENT(new);
+BUFFER_HEAD_TRACE_EVENT(async_read);
+BUFFER_HEAD_TRACE_EVENT(async_write);
+BUFFER_HEAD_TRACE_EVENT(delay);
+BUFFER_HEAD_TRACE_EVENT(boundary);
+BUFFER_HEAD_TRACE_EVENT(write_io_error);
+BUFFER_HEAD_TRACE_EVENT(ordered);
+BUFFER_HEAD_TRACE_EVENT(eopnotsupp);
+BUFFER_HEAD_TRACE_EVENT(unwritten);
+
+/* jbd */
+BUFFER_HEAD_TRACE_EVENT(jbd);
+BUFFER_HEAD_TRACE_EVENT(jwrite);
+BUFFER_HEAD_TRACE_EVENT(jbddirty);
+BUFFER_HEAD_TRACE_EVENT(revoked);
+BUFFER_HEAD_TRACE_EVENT(revokevalid);
+BUFFER_HEAD_TRACE_EVENT(freed);
+
+#endif /* _TRACE_BUFFER_HEAD_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
--
1.6.5.2.74.g610f9
next reply other threads:[~2009-11-11 18:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-11 18:30 Aneesh Kumar K.V [this message]
2009-11-11 18:31 ` [RFC PATCH 2/2] ext[34]: Make sure we initialize the b_bdev field of dummy buffer_heads Aneesh Kumar K.V
2009-11-11 18:39 ` [RFC PATCH 1/2] vfs: tracepoints for buffer flag updates Aneesh Kumar K.V
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=1257964260-14020-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=cmm@us.ibm.com \
--cc=linux-ext4@vger.kernel.org \
--cc=sandeen@redhat.com \
--cc=tytso@mit.edu \
/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