Add block_touch_buffer tracepoint which gets triggered on
touch_buffer().

This is part of tracepoint additions to improve visiblity into
dirtying / writeback operations for io tracer and userland.

Signed-off-by: Tejun Heo <t...@kernel.org>
---
 fs/buffer.c                  |  2 ++
 include/trace/events/block.h | 25 +++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/fs/buffer.c b/fs/buffer.c
index a8c2dfb..4d9169d 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);
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index b408f51..e206cc6 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -6,10 +6,35 @@
 
 #include <linux/blktrace_api.h>
 #include <linux/blkdev.h>
+#include <linux/buffer_head.h>
 #include <linux/tracepoint.h>
 
 #define RWBS_LEN       8
 
+TRACE_EVENT(block_touch_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
+       )
+);
+
 DECLARE_EVENT_CLASS(block_rq_with_error,
 
        TP_PROTO(struct request_queue *q, struct request *rq),
-- 
1.8.0.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to