From: Tejun Heo <tj@kernel.org>
To: axboe@kernel.dk
Cc: linux-kernel@vger.kernel.org, chavey@google.com,
fengguang.wu@intel.com, Tejun Heo <tj@kernel.org>
Subject: [PATCH 4/5] block: add block_{touch|dirty}_buffer tracepoint
Date: Fri, 11 Jan 2013 13:06:36 -0800 [thread overview]
Message-ID: <1357938397-5413-5-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1357938397-5413-1-git-send-email-tj@kernel.org>
The former is triggered from touch_buffer() and the latter
mark_buffer_dirty().
This is part of tracepoint additions to improve visiblity into
dirtying / writeback operations for io tracer and userland.
v2: Transformed writeback_dirty_buffer to block_dirty_buffer and made
it share TP definition with block_touch_buffer.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Fengguang Wu <fengguang.wu@intel.com>
---
fs/buffer.c | 4 ++++
include/trace/events/block.h | 51 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+)
diff --git a/fs/buffer.c b/fs/buffer.c
index a8c2dfb..87ff335 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -41,6 +41,7 @@
#include <linux/bitops.h>
#include <linux/mpage.h>
#include <linux/bit_spinlock.h>
+#include <trace/events/block.h>
static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
@@ -55,6 +56,7 @@ EXPORT_SYMBOL(init_buffer);
inline void touch_buffer(struct buffer_head *bh)
{
+ trace_block_touch_buffer(bh);
mark_page_accessed(bh->b_page);
}
EXPORT_SYMBOL(touch_buffer);
@@ -1119,6 +1121,8 @@ void mark_buffer_dirty(struct buffer_head *bh)
{
WARN_ON_ONCE(!buffer_uptodate(bh));
+ trace_block_dirty_buffer(bh);
+
/*
* Very *carefully* optimize the it-is-already-dirty case.
*
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index b408f51..9961726 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -6,10 +6,61 @@
#include <linux/blktrace_api.h>
#include <linux/blkdev.h>
+#include <linux/buffer_head.h>
#include <linux/tracepoint.h>
#define RWBS_LEN 8
+DECLARE_EVENT_CLASS(block_buffer,
+
+ TP_PROTO(struct buffer_head *bh),
+
+ TP_ARGS(bh),
+
+ TP_STRUCT__entry (
+ __field( dev_t, dev )
+ __field( sector_t, sector )
+ __field( size_t, size )
+ ),
+
+ TP_fast_assign(
+ __entry->dev = bh->b_bdev->bd_dev;
+ __entry->sector = bh->b_blocknr;
+ __entry->size = bh->b_size;
+ ),
+
+ TP_printk("%d,%d sector=%llu size=%zu",
+ MAJOR(__entry->dev), MINOR(__entry->dev),
+ (unsigned long long)__entry->sector, __entry->size
+ )
+);
+
+/**
+ * block_touch_buffer - mark a buffer accessed
+ * @bh: buffer_head being touched
+ *
+ * Called from touch_buffer().
+ */
+DEFINE_EVENT(block_buffer, block_touch_buffer,
+
+ TP_PROTO(struct buffer_head *bh),
+
+ TP_ARGS(bh)
+);
+
+/**
+ * block_dirty_buffer - mark a buffer dirty
+ * @bh: buffer_head being dirtied
+ *
+ * Called from mark_buffer_dirty().
+ */
+DEFINE_EVENT(block_buffer, block_dirty_buffer,
+
+ TP_PROTO(struct buffer_head *bh),
+
+ TP_ARGS(bh)
+);
+
DECLARE_EVENT_CLASS(block_rq_with_error,
TP_PROTO(struct request_queue *q, struct request *rq),
--
1.8.0.2
next prev parent reply other threads:[~2013-01-11 21:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-11 21:06 [PATCHSET] block: improve tracepoints, take#2 Tejun Heo
2013-01-11 21:06 ` [PATCH 1/5] block: add missing block_bio_complete() tracepoint Tejun Heo
2013-01-11 21:06 ` [PATCH 2/5] block: add @req to bio_{front|back}_merge tracepoints Tejun Heo
2013-01-11 21:06 ` [PATCH 3/5] buffer: make touch_buffer() an exported function Tejun Heo
2013-01-11 21:06 ` Tejun Heo [this message]
2013-01-11 21:06 ` [PATCH 5/5] writeback: add more tracepoints Tejun Heo
2013-01-12 3:17 ` Fengguang Wu
2013-01-14 13:57 ` Jan Kara
2013-01-14 14:02 ` [PATCHSET] block: improve tracepoints, take#2 Jens Axboe
2013-01-14 17:43 ` Tejun Heo
2013-01-14 18:22 ` [PATCH] writeback: mark sysctl vm.block_dump for removal Tejun Heo
2013-01-14 19:00 ` Jan Kara
2013-01-15 16:28 ` [PATCH v2] " Tejun Heo
2013-01-16 2:07 ` Jan Kara
2013-01-16 2:53 ` Fengguang Wu
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=1357938397-5413-5-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=axboe@kernel.dk \
--cc=chavey@google.com \
--cc=fengguang.wu@intel.com \
--cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).