linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: Add a trace point whenever a barrier IO request is sent
@ 2010-04-21 20:56 Darrick J. Wong
  2010-04-21 21:27 ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2010-04-21 20:56 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel, linux-ext4

Simple debugging patch used to watch for barrier requests.  I've been using
this to watch ext4's barrier=1 behavior.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
---

 block/blk-core.c             |    4 ++++
 include/trace/events/block.h |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 0 deletions(-)


diff --git a/block/blk-core.c b/block/blk-core.c
index 9fe174d..fe02ea7 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -36,6 +36,7 @@
 EXPORT_TRACEPOINT_SYMBOL_GPL(block_remap);
 EXPORT_TRACEPOINT_SYMBOL_GPL(block_rq_remap);
 EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_complete);
+EXPORT_TRACEPOINT_SYMBOL_GPL(block_barrier);
 
 static int __make_request(struct request_queue *q, struct bio *bio);
 
@@ -1135,6 +1136,9 @@ void init_request_from_bio(struct request *req, struct bio *bio)
 	if (bio_rw_flagged(bio, BIO_RW_NOIDLE))
 		req->cmd_flags |= REQ_NOIDLE;
 
+	if (req->cmd_flags & (REQ_HARDBARRIER | REQ_SOFTBARRIER))
+		trace_block_barrier(req, bio);
+
 	req->errors = 0;
 	req->__sector = bio->bi_sector;
 	req->ioprio = bio_prio(bio);
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index d870a91..ccf96c3 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -198,6 +198,41 @@ TRACE_EVENT(block_bio_bounce,
 );
 
 /**
+ * block_barrier - barrier operation requested
+ * @r: request that asked for the barrier
+ * @bio: block operation
+ *
+ * This tracepoint indicates that a barrier operation has been
+ * requested and a flush will be sent to the underlying block
+ * device.
+ */
+TRACE_EVENT(block_barrier,
+
+	TP_PROTO(struct request *r, struct bio *bio),
+
+	TP_ARGS(r, bio),
+
+	TP_STRUCT__entry(
+		__field( dev_t,		dev		)
+		__field( sector_t,	sector		)
+		__field( unsigned,	nr_sector	)
+		__field( unsigned,	cmd_flags	)
+	),
+
+	TP_fast_assign(
+		__entry->dev		= bio->bi_bdev->bd_dev;
+		__entry->sector		= bio->bi_sector;
+		__entry->nr_sector	= bio->bi_size >> 9;
+		__entry->cmd_flags	= r->cmd_flags;
+	),
+
+	TP_printk("%d:%d %llu + %u [0x%x]",
+		  MAJOR(__entry->dev), MINOR(__entry->dev),
+		  (unsigned long long)__entry->sector,
+		  __entry->nr_sector, __entry->cmd_flags)
+);
+
+/**
  * block_bio_complete - completed all work on the block operation
  * @q: queue holding the block operation
  * @bio: block operation completed

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] block: Add a trace point whenever a barrier IO request is  sent
  2010-04-21 20:56 [PATCH] block: Add a trace point whenever a barrier IO request is sent Darrick J. Wong
@ 2010-04-21 21:27 ` Jens Axboe
  2010-04-23 19:41   ` Darrick J. Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2010-04-21 21:27 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-kernel, linux-ext4

On Wed, Apr 21 2010, Darrick J. Wong wrote:
> Simple debugging patch used to watch for barrier requests.  I've been using
> this to watch ext4's barrier=1 behavior.

But barriers are already being logged, if you watch blkparse data, it'll
be RB or WB events. So I don't see what this addition provides that we
don't already have?

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] block: Add a trace point whenever a barrier IO request is sent
  2010-04-21 21:27 ` Jens Axboe
@ 2010-04-23 19:41   ` Darrick J. Wong
  0 siblings, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2010-04-23 19:41 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel, linux-ext4

On Wed, Apr 21, 2010 at 11:27:27PM +0200, Jens Axboe wrote:
> On Wed, Apr 21 2010, Darrick J. Wong wrote:
> > Simple debugging patch used to watch for barrier requests.  I've been using
> > this to watch ext4's barrier=1 behavior.
> 
> But barriers are already being logged, if you watch blkparse data, it'll
> be RB or WB events. So I don't see what this addition provides that we
> don't already have?

I also have the function graph tracer turned on, so I can (try to) map barrier
requests to specific chunks of ext4 code.  But, maybe there's a way to do this
with blkparse that I haven't found yet?

--D

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-04-23 19:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-21 20:56 [PATCH] block: Add a trace point whenever a barrier IO request is sent Darrick J. Wong
2010-04-21 21:27 ` Jens Axboe
2010-04-23 19:41   ` Darrick J. Wong

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).