diff mbox series

[V7,1/2] block: create event class for rq completion

Message ID 20220205091150.6105-2-chaitanyak@nvidia.com (mailing list archive)
State New, archived
Headers show
Series [V7,1/2] block: create event class for rq completion | expand

Commit Message

Chaitanya Kulkarni Feb. 5, 2022, 9:11 a.m. UTC
From: Chaitanya Kulkarni <kch@nvidia.com>

Move the existing code from TRACE_EVENT block_rq_complete() into new
event class block_rq_completion(). Add a new event block_rq_complete()
from newly created event class block_rq_completion().

This prep patch is needed to resue the code into new tracepoint
block_rq_error() in the next patch.

Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
 include/trace/events/block.h | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

Comments

Yang Shi Feb. 7, 2022, 5:19 p.m. UTC | #1
On Sat, Feb 5, 2022 at 1:12 AM Chaitanya Kulkarni <chaitanyak@nvidia.com> wrote:
>
> From: Chaitanya Kulkarni <kch@nvidia.com>
>
> Move the existing code from TRACE_EVENT block_rq_complete() into new
> event class block_rq_completion(). Add a new event block_rq_complete()
> from newly created event class block_rq_completion().
>
> This prep patch is needed to resue the code into new tracepoint

Just a minor nit:
s/resue/reuse

> block_rq_error() in the next patch.
>
> Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>

Reviewed-by: Yang Shi <shy828301@gmail.com>

> ---
>  include/trace/events/block.h | 33 ++++++++++++++++++++-------------
>  1 file changed, 20 insertions(+), 13 deletions(-)
>
> diff --git a/include/trace/events/block.h b/include/trace/events/block.h
> index 27170e40e8c9..1519068bd1ab 100644
> --- a/include/trace/events/block.h
> +++ b/include/trace/events/block.h
> @@ -100,19 +100,7 @@ TRACE_EVENT(block_rq_requeue,
>                   __entry->nr_sector, 0)
>  );
>
> -/**
> - * block_rq_complete - block IO operation completed by device driver
> - * @rq: block operations request
> - * @error: status code
> - * @nr_bytes: number of completed bytes
> - *
> - * The block_rq_complete tracepoint event indicates that some portion
> - * of operation request has been completed by the device driver.  If
> - * the @rq->bio is %NULL, then there is absolutely no additional work to
> - * do for the request. If @rq->bio is non-NULL then there is
> - * additional work required to complete the request.
> - */
> -TRACE_EVENT(block_rq_complete,
> +DECLARE_EVENT_CLASS(block_rq_completion,
>
>         TP_PROTO(struct request *rq, blk_status_t error, unsigned int nr_bytes),
>
> @@ -144,6 +132,25 @@ TRACE_EVENT(block_rq_complete,
>                   __entry->nr_sector, __entry->error)
>  );
>
> +/**
> + * block_rq_complete - block IO operation completed by device driver
> + * @rq: block operations request
> + * @error: status code
> + * @nr_bytes: number of completed bytes
> + *
> + * The block_rq_complete tracepoint event indicates that some portion
> + * of operation request has been completed by the device driver.  If
> + * the @rq->bio is %NULL, then there is absolutely no additional work to
> + * do for the request. If @rq->bio is non-NULL then there is
> + * additional work required to complete the request.
> + */
> +DEFINE_EVENT(block_rq_completion, block_rq_complete,
> +
> +       TP_PROTO(struct request *rq, blk_status_t error, unsigned int nr_bytes),
> +
> +       TP_ARGS(rq, error, nr_bytes)
> +);
> +
>  DECLARE_EVENT_CLASS(block_rq,
>
>         TP_PROTO(struct request *rq),
> --
> 2.29.0
>
Christoph Hellwig Feb. 9, 2022, 3:14 p.m. UTC | #2
It seems a bit silly to add the even class without the second user.

But I'm fine with this if we'd just merge them together.
Yang Shi Feb. 10, 2022, 5:58 p.m. UTC | #3
On Wed, Feb 9, 2022 at 7:14 AM Christoph Hellwig <hch@infradead.org> wrote:
>
> It seems a bit silly to add the even class without the second user.
>
> But I'm fine with this if we'd just merge them together.

OK, I will merge them together. Thanks.
diff mbox series

Patch

diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 27170e40e8c9..1519068bd1ab 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -100,19 +100,7 @@  TRACE_EVENT(block_rq_requeue,
 		  __entry->nr_sector, 0)
 );
 
-/**
- * block_rq_complete - block IO operation completed by device driver
- * @rq: block operations request
- * @error: status code
- * @nr_bytes: number of completed bytes
- *
- * The block_rq_complete tracepoint event indicates that some portion
- * of operation request has been completed by the device driver.  If
- * the @rq->bio is %NULL, then there is absolutely no additional work to
- * do for the request. If @rq->bio is non-NULL then there is
- * additional work required to complete the request.
- */
-TRACE_EVENT(block_rq_complete,
+DECLARE_EVENT_CLASS(block_rq_completion,
 
 	TP_PROTO(struct request *rq, blk_status_t error, unsigned int nr_bytes),
 
@@ -144,6 +132,25 @@  TRACE_EVENT(block_rq_complete,
 		  __entry->nr_sector, __entry->error)
 );
 
+/**
+ * block_rq_complete - block IO operation completed by device driver
+ * @rq: block operations request
+ * @error: status code
+ * @nr_bytes: number of completed bytes
+ *
+ * The block_rq_complete tracepoint event indicates that some portion
+ * of operation request has been completed by the device driver.  If
+ * the @rq->bio is %NULL, then there is absolutely no additional work to
+ * do for the request. If @rq->bio is non-NULL then there is
+ * additional work required to complete the request.
+ */
+DEFINE_EVENT(block_rq_completion, block_rq_complete,
+
+	TP_PROTO(struct request *rq, blk_status_t error, unsigned int nr_bytes),
+
+	TP_ARGS(rq, error, nr_bytes)
+);
+
 DECLARE_EVENT_CLASS(block_rq,
 
 	TP_PROTO(struct request *rq),