linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] block: add missing block_bio_complete() tracepoint
@ 2012-01-17  1:32 Namhyung Kim
  2012-01-17  1:32 ` [PATCH 2/3] block: prevent duplicated bio completion report Namhyung Kim
  2012-01-17  1:32 ` [PATCH 3/3] block: don't export block_bio_complete tracepoint Namhyung Kim
  0 siblings, 2 replies; 7+ messages in thread
From: Namhyung Kim @ 2012-01-17  1:32 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Namhyung Kim, linux-kernel, Tejun Heo, Steven Rostedt

The block_bio_complete() TP has been missed so long,
so that bio-based drivers haven't been able to trace
its IO behavior. Add it.

In some rare cases, such as loop_switch, @bio->bi_bdev
can be NULL. Thus convert it to TRACE_EVENT_CONDITION()
as Steven suggested.

>From now on, request-based drivers will also get
BLK_TA_COMPLETEs for all bio's in requests. This needs
to be handled in userland properly.

Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
---
 fs/bio.c                     |    2 ++
 include/trace/events/block.h |    4 +++-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/fs/bio.c b/fs/bio.c
index b1fe82cf88cf..14c03eaf384e 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -1447,6 +1447,8 @@ void bio_endio(struct bio *bio, int error)
 	else if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
 		error = -EIO;
 
+	trace_block_bio_complete(bdev_get_queue(bio->bi_bdev), bio, error);
+
 	if (bio->bi_end_io)
 		bio->bi_end_io(bio, error);
 }
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 05c5e61f0a7c..96955f4828b3 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -213,12 +213,14 @@ TRACE_EVENT(block_bio_bounce,
  * This tracepoint indicates there is no further work to do on this
  * block IO operation @bio.
  */
-TRACE_EVENT(block_bio_complete,
+TRACE_EVENT_CONDITION(block_bio_complete,
 
 	TP_PROTO(struct request_queue *q, struct bio *bio, int error),
 
 	TP_ARGS(q, bio, error),
 
+	TP_CONDITION(bio->bi_bdev != NULL),
+
 	TP_STRUCT__entry(
 		__field( dev_t,		dev		)
 		__field( sector_t,	sector		)
-- 
1.7.9.rc1.dirty


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH v2 0/3] blktrace: bio-based device tracing improvement
@ 2011-09-04 13:15 Namhyung Kim
  2011-09-04 13:15 ` [PATCH 3/3] block: don't export block_bio_complete tracepoint Namhyung Kim
  0 siblings, 1 reply; 7+ messages in thread
From: Namhyung Kim @ 2011-09-04 13:15 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-fsdevel, linux-kernel

Hello,

The blktrace is used to report block device activities to user space
using kernel tracepoint but it was focused to block I/O request struct.
Thus bio-based devices (i.e. loop, ram, md, ...) which don't make use
of the request structure could not be supported well - the tool only
can detect a limited number of events such as queuing, cloning and
remapping but it cannot know when the I/O activity is completed.

bio_endio(), the I/O completion callback, can be used to fix this
problem by adding appropriate tracepoint in it. However it was called
from other paths too (normal request-based block devices and some of
nested block I/O handling routines) so that we should recognize such
cases to prevent duplicated reports. In this series, BIO_IN_FLIGHT flag
is introduced and used for that purpose.

Note that (bio-based) dm already supported completion report by adding
the tracepoint into the path manually. With this patches, it will be
converted to use generic mechanism.

Changes from v1:
 * kill __bio_endio()
 * use BIO_IN_FLIGHT flag

Any feedbacks are welcome.

Thanks.

Namhyung Kim (3):
  block: move trace_block_bio_remap() before blk_partition_remap
  block: introduce BIO_IN_FLIGHT flag
  block: don't export block_bio_complete tracepoint

 block/blk-core.c          |   12 ++++++++----
 drivers/md/dm.c           |    1 -
 fs/bio.c                  |    9 +++++++++
 include/linux/blk_types.h |    1 +
 4 files changed, 18 insertions(+), 5 deletions(-)

-- 
1.7.6


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

end of thread, other threads:[~2012-01-19  1:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-17  1:32 [PATCH 1/3] block: add missing block_bio_complete() tracepoint Namhyung Kim
2012-01-17  1:32 ` [PATCH 2/3] block: prevent duplicated bio completion report Namhyung Kim
2012-01-17 17:45   ` Tejun Heo
2012-01-18  1:20     ` Namhyung Kim
2012-01-19  1:14       ` Namhyung Kim
2012-01-17  1:32 ` [PATCH 3/3] block: don't export block_bio_complete tracepoint Namhyung Kim
  -- strict thread matches above, loose matches on Subject: below --
2011-09-04 13:15 [PATCH v2 0/3] blktrace: bio-based device tracing improvement Namhyung Kim
2011-09-04 13:15 ` [PATCH 3/3] block: don't export block_bio_complete tracepoint Namhyung Kim

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