FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 02-05-2010, 04:45 AM
Dave Chinner
 
Default gfs2: add IO submission trace points

Useful for tracking down where specific IOs are being issued
from.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/gfs2/log.c | 6 ++++++
fs/gfs2/lops.c | 6 ++++++
fs/gfs2/trace_gfs2.h | 41 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 4511b08..bd26dff 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -121,6 +121,7 @@ __acquires(&sdp->sd_log_lock)
lock_buffer(bh);
if (test_clear_buffer_dirty(bh)) {
bh->b_end_io = end_buffer_write_sync;
+ trace_gfs2_submit_bh(bh, WRITE_SYNC_PLUG, __func__);
submit_bh(WRITE_SYNC_PLUG, bh);
} else {
unlock_buffer(bh);
@@ -610,6 +611,8 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags, int pull)
if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags))
goto skip_barrier;
get_bh(bh);
+ trace_gfs2_submit_bh(bh, WRITE_SYNC | (1 << BIO_RW_BARRIER) | (1 <<
+ BIO_RW_META), __func__);
submit_bh(WRITE_SYNC | (1 << BIO_RW_BARRIER) | (1 << BIO_RW_META), bh);
wait_on_buffer(bh);
if (buffer_eopnotsupp(bh)) {
@@ -619,6 +622,8 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags, int pull)
lock_buffer(bh);
skip_barrier:
get_bh(bh);
+ trace_gfs2_submit_bh(bh, WRITE_SYNC | (1 << BIO_RW_META),
+ __func__);
submit_bh(WRITE_SYNC | (1 << BIO_RW_META), bh);
wait_on_buffer(bh);
}
@@ -670,6 +675,7 @@ static void gfs2_ordered_write(struct gfs2_sbd *sdp)
lock_buffer(bh);
if (buffer_mapped(bh) && test_clear_buffer_dirty(bh)) {
bh->b_end_io = end_buffer_write_sync;
+ trace_gfs2_submit_bh(bh, WRITE_SYNC_PLUG, __func__);
submit_bh(WRITE_SYNC_PLUG, bh);
} else {
unlock_buffer(bh);
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
index de97632..5708edf 100644
--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -198,6 +198,7 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp)
}

gfs2_log_unlock(sdp);
+ trace_gfs2_submit_bh(bh, WRITE_SYNC_PLUG, __func__);
submit_bh(WRITE_SYNC_PLUG, bh);
gfs2_log_lock(sdp);

@@ -208,6 +209,7 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp)
gfs2_log_unlock(sdp);
lock_buffer(bd2->bd_bh);
bh = gfs2_log_fake_buf(sdp, bd2->bd_bh);
+ trace_gfs2_submit_bh(bh, WRITE_SYNC_PLUG, __func__);
submit_bh(WRITE_SYNC_PLUG, bh);
gfs2_log_lock(sdp);
if (++n >= num)
@@ -350,6 +352,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp)
sdp->sd_log_num_revoke--;

if (offset + sizeof(u64) > sdp->sd_sb.sb_bsize) {
+ trace_gfs2_submit_bh(bh, WRITE_SYNC_PLUG, __func__);
submit_bh(WRITE_SYNC_PLUG, bh);

bh = gfs2_log_get_buf(sdp);
@@ -367,6 +370,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp)
}
gfs2_assert_withdraw(sdp, !sdp->sd_log_num_revoke);

+ trace_gfs2_submit_bh(bh, WRITE_SYNC_PLUG, __func__);
submit_bh(WRITE_SYNC_PLUG, bh);
}

@@ -569,6 +573,7 @@ static void gfs2_write_blocks(struct gfs2_sbd *sdp, struct buffer_head *bh,
ptr = bh_log_ptr(bh);

get_bh(bh);
+ trace_gfs2_submit_bh(bh, WRITE_SYNC_PLUG, __func__);
submit_bh(WRITE_SYNC_PLUG, bh);
gfs2_log_lock(sdp);
while(!list_empty(list)) {
@@ -595,6 +600,7 @@ static void gfs2_write_blocks(struct gfs2_sbd *sdp, struct buffer_head *bh,
} else {
bh1 = gfs2_log_fake_buf(sdp, bd->bd_bh);
}
+ trace_gfs2_submit_bh(bh1, WRITE_SYNC_PLUG, __func__);
submit_bh(WRITE_SYNC_PLUG, bh1);
gfs2_log_lock(sdp);
ptr += 2;
diff --git a/fs/gfs2/trace_gfs2.h b/fs/gfs2/trace_gfs2.h
index 148d55c..e9a231d 100644
--- a/fs/gfs2/trace_gfs2.h
+++ b/fs/gfs2/trace_gfs2.h
@@ -397,6 +397,47 @@ TRACE_EVENT(gfs2_block_alloc,
block_state_name(__entry->block_state))
);

+#include <linux/fs.h>
+#include <linux/bio.h>
+
+#define BH_IO_TYPE
+ { READ, "read" },
+ { WRITE, "write" },
+ { READA, "readahead" },
+ { SWRITE, "swrite" },
+ { READ_SYNC, "read sync" },
+ { READ_META, "read meta" },
+ { WRITE_SYNC, "write sync" },
+ { WRITE_SYNC_PLUG, "write sync plug" },
+ { WRITE_META, "write meta" },
+ { WRITE_BARRIER, "write barrier" }
+
+TRACE_EVENT(gfs2_submit_bh,
+ TP_PROTO(struct buffer_head *bh, int rw, const char * func),
+ TP_ARGS(bh, rw, func),
+ TP_STRUCT__entry(
+ __field(dev_t, dev)
+ __field(unsigned long long, bno)
+ __field(unsigned long long, len)
+ __field(int, rw)
+ __field(const char *, func)
+ ),
+ TP_fast_assign(
+ __entry->dev = bh->b_bdev->bd_dev;
+ __entry->bno = bh->b_blocknr;
+ __entry->len = bh->b_size;
+ __entry->rw = rw;
+ __entry->func = func;
+ ),
+ TP_printk("dev %d:%d %s bno %llu len %llu caller %s",
+ MAJOR(__entry->dev), MINOR(__entry->dev),
+ __print_symbolic(__entry->rw, BH_IO_TYPE),
+ __entry->bno,
+ __entry->len,
+ __entry->func)
+);
+
+
#endif /* _TRACE_GFS2_H */

/* This part must be outside protection */
--
1.6.5
 
Old 02-05-2010, 08:49 AM
Steven Whitehouse
 
Default gfs2: add IO submission trace points

Hi,

On Fri, 2010-02-05 at 16:45 +1100, Dave Chinner wrote:
> Useful for tracking down where specific IOs are being issued
> from.
>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/gfs2/log.c | 6 ++++++
> fs/gfs2/lops.c | 6 ++++++
> fs/gfs2/trace_gfs2.h | 41 +++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 53 insertions(+), 0 deletions(-)
>
> diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
> index 4511b08..bd26dff 100644
> --- a/fs/gfs2/log.c
> +++ b/fs/gfs2/log.c
> @@ -121,6 +121,7 @@ __acquires(&sdp->sd_log_lock)
> lock_buffer(bh);
> if (test_clear_buffer_dirty(bh)) {
> bh->b_end_io = end_buffer_write_sync;
> + trace_gfs2_submit_bh(bh, WRITE_SYNC_PLUG, __func__);
> submit_bh(WRITE_SYNC_PLUG, bh);
This looks like it could be a generically useful function, I wonder if
it would be possible to do this directly in submit_bh, since we should
be able to use __builtin_return_address(0) to find out the origin of the
call?

Steve.
 

Thread Tools




All times are GMT. The time now is 04:22 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org