public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] blktrace: add missing probe argument to block_bio_complete
@ 2011-01-07  1:54 Mathieu Desnoyers
  2011-01-07 14:13 ` Jeff Moyer
  0 siblings, 1 reply; 5+ messages in thread
From: Mathieu Desnoyers @ 2011-01-07  1:54 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jeff Moyer, Steven Rostedt, Frederic Weisbecker, Ingo Molnar,
	Thomas Gleixner, Li Zefan, linux-kernel

blktrace.c block bio complete callback needs to gain a new argument to reflect
the newly added "error" tracepoint argument. This is needed to match the new
block_bio_complete TRACE_EVENT as of
commit de983a7bfcb7c020901ca6e2314cf55a4207ab5a.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Jeff Moyer <jmoyer@redhat.com>
CC: Steven Rostedt <rostedt@goodmis.org>
CC: Frederic Weisbecker <fweisbec@gmail.com>
CC: Ingo Molnar <mingo@elte.hu>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Jens Axboe <axboe@kernel.dk>
CC: Li Zefan <lizf@cn.fujitsu.com>
---
 kernel/trace/blktrace.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6-lttng/kernel/trace/blktrace.c
===================================================================
--- linux-2.6-lttng.orig/kernel/trace/blktrace.c
+++ linux-2.6-lttng/kernel/trace/blktrace.c
@@ -785,7 +785,8 @@ static void blk_add_trace_bio_bounce(voi
 }
 
 static void blk_add_trace_bio_complete(void *ignore,
-				       struct request_queue *q, struct bio *bio)
+				       struct request_queue *q, struct bio *bio,
+				       int error)
 {
 	blk_add_trace_bio(q, bio, BLK_TA_COMPLETE);
 }
-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

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

* Re: [PATCH] blktrace: add missing probe argument to block_bio_complete
  2011-01-07  1:54 [PATCH] blktrace: add missing probe argument to block_bio_complete Mathieu Desnoyers
@ 2011-01-07 14:13 ` Jeff Moyer
  2011-01-07 15:18   ` Jens Axboe
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Moyer @ 2011-01-07 14:13 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Jens Axboe, Steven Rostedt, Frederic Weisbecker, Ingo Molnar,
	Thomas Gleixner, Li Zefan, linux-kernel

Mathieu Desnoyers <mathieu.desnoyers@efficios.com> writes:

> blktrace.c block bio complete callback needs to gain a new argument to reflect
> the newly added "error" tracepoint argument. This is needed to match the new
> block_bio_complete TRACE_EVENT as of
> commit de983a7bfcb7c020901ca6e2314cf55a4207ab5a.
>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> CC: Jeff Moyer <jmoyer@redhat.com>
> CC: Steven Rostedt <rostedt@goodmis.org>
> CC: Frederic Weisbecker <fweisbec@gmail.com>
> CC: Ingo Molnar <mingo@elte.hu>
> CC: Thomas Gleixner <tglx@linutronix.de>
> CC: Jens Axboe <axboe@kernel.dk>
> CC: Li Zefan <lizf@cn.fujitsu.com>
> ---
>  kernel/trace/blktrace.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> Index: linux-2.6-lttng/kernel/trace/blktrace.c
> ===================================================================
> --- linux-2.6-lttng.orig/kernel/trace/blktrace.c
> +++ linux-2.6-lttng/kernel/trace/blktrace.c
> @@ -785,7 +785,8 @@ static void blk_add_trace_bio_bounce(voi
>  }
>  
>  static void blk_add_trace_bio_complete(void *ignore,
> -				       struct request_queue *q, struct bio *bio)
> +				       struct request_queue *q, struct bio *bio,
> +				       int error)
>  {
>  	blk_add_trace_bio(q, bio, BLK_TA_COMPLETE);
>  }

OK, I clearly didn't look closely enough last time.  There's no sense
passing this information down if it isn't used (as you said initially).
blk_add_trace_bio sets the error based on whether or not the
BIO_UPTODATE bit is set.  So, I think we should instead revert the patch
I sent you (Mathieu), and then completely get rid of the error field in
the TP macros.

Does that make sense to everyone else?

Cheers,
Jeff

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

* Re: [PATCH] blktrace: add missing probe argument to block_bio_complete
  2011-01-07 14:13 ` Jeff Moyer
@ 2011-01-07 15:18   ` Jens Axboe
  2011-01-07 15:27     ` Jeff Moyer
  2011-01-07 17:41     ` Mathieu Desnoyers
  0 siblings, 2 replies; 5+ messages in thread
From: Jens Axboe @ 2011-01-07 15:18 UTC (permalink / raw)
  To: Jeff Moyer
  Cc: Mathieu Desnoyers, Steven Rostedt, Frederic Weisbecker,
	Ingo Molnar, Thomas Gleixner, Li Zefan, linux-kernel

On 2011-01-07 15:13, Jeff Moyer wrote:
> Mathieu Desnoyers <mathieu.desnoyers@efficios.com> writes:
> 
>> blktrace.c block bio complete callback needs to gain a new argument to reflect
>> the newly added "error" tracepoint argument. This is needed to match the new
>> block_bio_complete TRACE_EVENT as of
>> commit de983a7bfcb7c020901ca6e2314cf55a4207ab5a.
>>
>> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> CC: Jeff Moyer <jmoyer@redhat.com>
>> CC: Steven Rostedt <rostedt@goodmis.org>
>> CC: Frederic Weisbecker <fweisbec@gmail.com>
>> CC: Ingo Molnar <mingo@elte.hu>
>> CC: Thomas Gleixner <tglx@linutronix.de>
>> CC: Jens Axboe <axboe@kernel.dk>
>> CC: Li Zefan <lizf@cn.fujitsu.com>
>> ---
>>  kernel/trace/blktrace.c |    3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> Index: linux-2.6-lttng/kernel/trace/blktrace.c
>> ===================================================================
>> --- linux-2.6-lttng.orig/kernel/trace/blktrace.c
>> +++ linux-2.6-lttng/kernel/trace/blktrace.c
>> @@ -785,7 +785,8 @@ static void blk_add_trace_bio_bounce(voi
>>  }
>>  
>>  static void blk_add_trace_bio_complete(void *ignore,
>> -				       struct request_queue *q, struct bio *bio)
>> +				       struct request_queue *q, struct bio *bio,
>> +				       int error)
>>  {
>>  	blk_add_trace_bio(q, bio, BLK_TA_COMPLETE);
>>  }
> 
> OK, I clearly didn't look closely enough last time.  There's no sense
> passing this information down if it isn't used (as you said initially).
> blk_add_trace_bio sets the error based on whether or not the
> BIO_UPTODATE bit is set.  So, I think we should instead revert the patch
> I sent you (Mathieu), and then completely get rid of the error field in
> the TP macros.
> 
> Does that make sense to everyone else?

We usually use BIO_UPTODATE if we have no other information available.
So if we have, then we should use it.

diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index fab31af..153562d 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -758,54 +758,58 @@ static void blk_add_trace_rq_complete(void *ignore,
  * @q:		queue the io is for
  * @bio:	the source bio
  * @what:	the action
+ * @error:	error, if any
  *
  * Description:
  *     Records an action against a bio. Will log the bio offset + size.
  *
  **/
 static void blk_add_trace_bio(struct request_queue *q, struct bio *bio,
-				     u32 what)
+			      u32 what, int error)
 {
 	struct blk_trace *bt = q->blk_trace;
 
 	if (likely(!bt))
 		return;
 
+	if (!error && !bio_flagged(bio, BIO_UPTODATE))
+		error = EIO;
+
 	__blk_add_trace(bt, bio->bi_sector, bio->bi_size, bio->bi_rw, what,
-			!bio_flagged(bio, BIO_UPTODATE), 0, NULL);
+			error, 0, NULL);
 }
 
 static void blk_add_trace_bio_bounce(void *ignore,
 				     struct request_queue *q, struct bio *bio)
 {
-	blk_add_trace_bio(q, bio, BLK_TA_BOUNCE);
+	blk_add_trace_bio(q, bio, BLK_TA_BOUNCE, 0);
 }
 
 static void blk_add_trace_bio_complete(void *ignore,
 				       struct request_queue *q, struct bio *bio,
 				       int error)
 {
-	blk_add_trace_bio(q, bio, BLK_TA_COMPLETE);
+	blk_add_trace_bio(q, bio, BLK_TA_COMPLETE, error);
 }
 
 static void blk_add_trace_bio_backmerge(void *ignore,
 					struct request_queue *q,
 					struct bio *bio)
 {
-	blk_add_trace_bio(q, bio, BLK_TA_BACKMERGE);
+	blk_add_trace_bio(q, bio, BLK_TA_BACKMERGE, 0);
 }
 
 static void blk_add_trace_bio_frontmerge(void *ignore,
 					 struct request_queue *q,
 					 struct bio *bio)
 {
-	blk_add_trace_bio(q, bio, BLK_TA_FRONTMERGE);
+	blk_add_trace_bio(q, bio, BLK_TA_FRONTMERGE, 0);
 }
 
 static void blk_add_trace_bio_queue(void *ignore,
 				    struct request_queue *q, struct bio *bio)
 {
-	blk_add_trace_bio(q, bio, BLK_TA_QUEUE);
+	blk_add_trace_bio(q, bio, BLK_TA_QUEUE, 0);
 }
 
 static void blk_add_trace_getrq(void *ignore,
@@ -813,7 +817,7 @@ static void blk_add_trace_getrq(void *ignore,
 				struct bio *bio, int rw)
 {
 	if (bio)
-		blk_add_trace_bio(q, bio, BLK_TA_GETRQ);
+		blk_add_trace_bio(q, bio, BLK_TA_GETRQ, 0);
 	else {
 		struct blk_trace *bt = q->blk_trace;
 
@@ -828,7 +832,7 @@ static void blk_add_trace_sleeprq(void *ignore,
 				  struct bio *bio, int rw)
 {
 	if (bio)
-		blk_add_trace_bio(q, bio, BLK_TA_SLEEPRQ);
+		blk_add_trace_bio(q, bio, BLK_TA_SLEEPRQ, 0);
 	else {
 		struct blk_trace *bt = q->blk_trace;
 

-- 
Jens Axboe


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

* Re: [PATCH] blktrace: add missing probe argument to block_bio_complete
  2011-01-07 15:18   ` Jens Axboe
@ 2011-01-07 15:27     ` Jeff Moyer
  2011-01-07 17:41     ` Mathieu Desnoyers
  1 sibling, 0 replies; 5+ messages in thread
From: Jeff Moyer @ 2011-01-07 15:27 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Mathieu Desnoyers, Steven Rostedt, Frederic Weisbecker,
	Ingo Molnar, Thomas Gleixner, Li Zefan, linux-kernel

Jens Axboe <axboe@kernel.dk> writes:

> On 2011-01-07 15:13, Jeff Moyer wrote:
>> Mathieu Desnoyers <mathieu.desnoyers@efficios.com> writes:
>> 
>>> blktrace.c block bio complete callback needs to gain a new argument to reflect
>>> the newly added "error" tracepoint argument. This is needed to match the new
>>> block_bio_complete TRACE_EVENT as of
>>> commit de983a7bfcb7c020901ca6e2314cf55a4207ab5a.
>>>
>>> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>>> CC: Jeff Moyer <jmoyer@redhat.com>
>>> CC: Steven Rostedt <rostedt@goodmis.org>
>>> CC: Frederic Weisbecker <fweisbec@gmail.com>
>>> CC: Ingo Molnar <mingo@elte.hu>
>>> CC: Thomas Gleixner <tglx@linutronix.de>
>>> CC: Jens Axboe <axboe@kernel.dk>
>>> CC: Li Zefan <lizf@cn.fujitsu.com>
>>> ---
>>>  kernel/trace/blktrace.c |    3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> Index: linux-2.6-lttng/kernel/trace/blktrace.c
>>> ===================================================================
>>> --- linux-2.6-lttng.orig/kernel/trace/blktrace.c
>>> +++ linux-2.6-lttng/kernel/trace/blktrace.c
>>> @@ -785,7 +785,8 @@ static void blk_add_trace_bio_bounce(voi
>>>  }
>>>  
>>>  static void blk_add_trace_bio_complete(void *ignore,
>>> -				       struct request_queue *q, struct bio *bio)
>>> +				       struct request_queue *q, struct bio *bio,
>>> +				       int error)
>>>  {
>>>  	blk_add_trace_bio(q, bio, BLK_TA_COMPLETE);
>>>  }
>> 
>> OK, I clearly didn't look closely enough last time.  There's no sense
>> passing this information down if it isn't used (as you said initially).
>> blk_add_trace_bio sets the error based on whether or not the
>> BIO_UPTODATE bit is set.  So, I think we should instead revert the patch
>> I sent you (Mathieu), and then completely get rid of the error field in
>> the TP macros.
>> 
>> Does that make sense to everyone else?
>
> We usually use BIO_UPTODATE if we have no other information available.
> So if we have, then we should use it.

OK, I had contemplated doing it that way, too, but I wasn't sure how
often the error differed from EIO.  Anyway, this looks better.

Reviewed-by: Jeff Moyer <jmoyer@redhat.com>

>
> diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
> index fab31af..153562d 100644
> --- a/kernel/trace/blktrace.c
> +++ b/kernel/trace/blktrace.c
> @@ -758,54 +758,58 @@ static void blk_add_trace_rq_complete(void *ignore,
>   * @q:		queue the io is for
>   * @bio:	the source bio
>   * @what:	the action
> + * @error:	error, if any
>   *
>   * Description:
>   *     Records an action against a bio. Will log the bio offset + size.
>   *
>   **/
>  static void blk_add_trace_bio(struct request_queue *q, struct bio *bio,
> -				     u32 what)
> +			      u32 what, int error)
>  {
>  	struct blk_trace *bt = q->blk_trace;
>  
>  	if (likely(!bt))
>  		return;
>  
> +	if (!error && !bio_flagged(bio, BIO_UPTODATE))
> +		error = EIO;
> +
>  	__blk_add_trace(bt, bio->bi_sector, bio->bi_size, bio->bi_rw, what,
> -			!bio_flagged(bio, BIO_UPTODATE), 0, NULL);
> +			error, 0, NULL);
>  }
>  
>  static void blk_add_trace_bio_bounce(void *ignore,
>  				     struct request_queue *q, struct bio *bio)
>  {
> -	blk_add_trace_bio(q, bio, BLK_TA_BOUNCE);
> +	blk_add_trace_bio(q, bio, BLK_TA_BOUNCE, 0);
>  }
>  
>  static void blk_add_trace_bio_complete(void *ignore,
>  				       struct request_queue *q, struct bio *bio,
>  				       int error)
>  {
> -	blk_add_trace_bio(q, bio, BLK_TA_COMPLETE);
> +	blk_add_trace_bio(q, bio, BLK_TA_COMPLETE, error);
>  }
>  
>  static void blk_add_trace_bio_backmerge(void *ignore,
>  					struct request_queue *q,
>  					struct bio *bio)
>  {
> -	blk_add_trace_bio(q, bio, BLK_TA_BACKMERGE);
> +	blk_add_trace_bio(q, bio, BLK_TA_BACKMERGE, 0);
>  }
>  
>  static void blk_add_trace_bio_frontmerge(void *ignore,
>  					 struct request_queue *q,
>  					 struct bio *bio)
>  {
> -	blk_add_trace_bio(q, bio, BLK_TA_FRONTMERGE);
> +	blk_add_trace_bio(q, bio, BLK_TA_FRONTMERGE, 0);
>  }
>  
>  static void blk_add_trace_bio_queue(void *ignore,
>  				    struct request_queue *q, struct bio *bio)
>  {
> -	blk_add_trace_bio(q, bio, BLK_TA_QUEUE);
> +	blk_add_trace_bio(q, bio, BLK_TA_QUEUE, 0);
>  }
>  
>  static void blk_add_trace_getrq(void *ignore,
> @@ -813,7 +817,7 @@ static void blk_add_trace_getrq(void *ignore,
>  				struct bio *bio, int rw)
>  {
>  	if (bio)
> -		blk_add_trace_bio(q, bio, BLK_TA_GETRQ);
> +		blk_add_trace_bio(q, bio, BLK_TA_GETRQ, 0);
>  	else {
>  		struct blk_trace *bt = q->blk_trace;
>  
> @@ -828,7 +832,7 @@ static void blk_add_trace_sleeprq(void *ignore,
>  				  struct bio *bio, int rw)
>  {
>  	if (bio)
> -		blk_add_trace_bio(q, bio, BLK_TA_SLEEPRQ);
> +		blk_add_trace_bio(q, bio, BLK_TA_SLEEPRQ, 0);
>  	else {
>  		struct blk_trace *bt = q->blk_trace;

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

* Re: [PATCH] blktrace: add missing probe argument to block_bio_complete
  2011-01-07 15:18   ` Jens Axboe
  2011-01-07 15:27     ` Jeff Moyer
@ 2011-01-07 17:41     ` Mathieu Desnoyers
  1 sibling, 0 replies; 5+ messages in thread
From: Mathieu Desnoyers @ 2011-01-07 17:41 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jeff Moyer, Steven Rostedt, Frederic Weisbecker, Ingo Molnar,
	Thomas Gleixner, Li Zefan, linux-kernel

* Jens Axboe (axboe@kernel.dk) wrote:
> On 2011-01-07 15:13, Jeff Moyer wrote:
> > Mathieu Desnoyers <mathieu.desnoyers@efficios.com> writes:
> > 
> >> blktrace.c block bio complete callback needs to gain a new argument to reflect
> >> the newly added "error" tracepoint argument. This is needed to match the new
> >> block_bio_complete TRACE_EVENT as of
> >> commit de983a7bfcb7c020901ca6e2314cf55a4207ab5a.
> >>
> >> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> >> CC: Jeff Moyer <jmoyer@redhat.com>
> >> CC: Steven Rostedt <rostedt@goodmis.org>
> >> CC: Frederic Weisbecker <fweisbec@gmail.com>
> >> CC: Ingo Molnar <mingo@elte.hu>
> >> CC: Thomas Gleixner <tglx@linutronix.de>
> >> CC: Jens Axboe <axboe@kernel.dk>
> >> CC: Li Zefan <lizf@cn.fujitsu.com>
> >> ---
> >>  kernel/trace/blktrace.c |    3 ++-
> >>  1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> Index: linux-2.6-lttng/kernel/trace/blktrace.c
> >> ===================================================================
> >> --- linux-2.6-lttng.orig/kernel/trace/blktrace.c
> >> +++ linux-2.6-lttng/kernel/trace/blktrace.c
> >> @@ -785,7 +785,8 @@ static void blk_add_trace_bio_bounce(voi
> >>  }
> >>  
> >>  static void blk_add_trace_bio_complete(void *ignore,
> >> -				       struct request_queue *q, struct bio *bio)
> >> +				       struct request_queue *q, struct bio *bio,
> >> +				       int error)
> >>  {
> >>  	blk_add_trace_bio(q, bio, BLK_TA_COMPLETE);
> >>  }
> > 
> > OK, I clearly didn't look closely enough last time.  There's no sense
> > passing this information down if it isn't used (as you said initially).
> > blk_add_trace_bio sets the error based on whether or not the
> > BIO_UPTODATE bit is set.  So, I think we should instead revert the patch
> > I sent you (Mathieu), and then completely get rid of the error field in
> > the TP macros.
> > 
> > Does that make sense to everyone else?
> 
> We usually use BIO_UPTODATE if we have no other information available.
> So if we have, then we should use it.

Good point. I tested your patch below applied after "trace event block fix
unassigned field", and it builds fine. Please feel free to add my

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

Are you planning to apply it on top of "blktrace: add missing probe argument to
block_bio_complete" ? (which I see you have merged in block for-next)

Thanks,

Mathieu


-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

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

end of thread, other threads:[~2011-01-07 17:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-07  1:54 [PATCH] blktrace: add missing probe argument to block_bio_complete Mathieu Desnoyers
2011-01-07 14:13 ` Jeff Moyer
2011-01-07 15:18   ` Jens Axboe
2011-01-07 15:27     ` Jeff Moyer
2011-01-07 17:41     ` Mathieu Desnoyers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox