block: add block_{touch|dirty}_buffer tracepoint
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> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
f0059afd3e
commit
5305cb8308
|
@ -41,6 +41,7 @@
|
||||||
#include <linux/bitops.h>
|
#include <linux/bitops.h>
|
||||||
#include <linux/mpage.h>
|
#include <linux/mpage.h>
|
||||||
#include <linux/bit_spinlock.h>
|
#include <linux/bit_spinlock.h>
|
||||||
|
#include <trace/events/block.h>
|
||||||
|
|
||||||
static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
|
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)
|
inline void touch_buffer(struct buffer_head *bh)
|
||||||
{
|
{
|
||||||
|
trace_block_touch_buffer(bh);
|
||||||
mark_page_accessed(bh->b_page);
|
mark_page_accessed(bh->b_page);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(touch_buffer);
|
EXPORT_SYMBOL(touch_buffer);
|
||||||
|
@ -1119,6 +1121,8 @@ void mark_buffer_dirty(struct buffer_head *bh)
|
||||||
{
|
{
|
||||||
WARN_ON_ONCE(!buffer_uptodate(bh));
|
WARN_ON_ONCE(!buffer_uptodate(bh));
|
||||||
|
|
||||||
|
trace_block_dirty_buffer(bh);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Very *carefully* optimize the it-is-already-dirty case.
|
* Very *carefully* optimize the it-is-already-dirty case.
|
||||||
*
|
*
|
||||||
|
|
|
@ -6,10 +6,61 @@
|
||||||
|
|
||||||
#include <linux/blktrace_api.h>
|
#include <linux/blktrace_api.h>
|
||||||
#include <linux/blkdev.h>
|
#include <linux/blkdev.h>
|
||||||
|
#include <linux/buffer_head.h>
|
||||||
#include <linux/tracepoint.h>
|
#include <linux/tracepoint.h>
|
||||||
|
|
||||||
#define RWBS_LEN 8
|
#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,
|
DECLARE_EVENT_CLASS(block_rq_with_error,
|
||||||
|
|
||||||
TP_PROTO(struct request_queue *q, struct request *rq),
|
TP_PROTO(struct request_queue *q, struct request *rq),
|
||||||
|
|
Loading…
Reference in New Issue