On Fri, Feb 4, 2022 at 12:35 AM Chaitanya Kulkarni <chaitanyak@xxxxxxxxxx> wrote: > > Yang, > > > Question 1 :- What prevents us from using the same format for > > both blk_rq_complete() and blk_rq_error() ? > > > > Question 2 :- assuming that blk_rq_complete() and blk_rq_error() > > are using same format why can't we :- > > > > declare DECLARE_EVENT_CLASS(blk_rq_completion....) > > and use that class for blk_rq_complete() and blk_rq_error() ? > > > > since if I remember correctly we need to define a event class > > instead of duplicating a tracepoint with similar reporting. > > What I meant is following compile tested patch (although it will > need to split into a prep patch in order to post it) :- Thank you so much. I will prepare the new patches. I assume you prefer a prep patch which converts trace event to event class, then add block_rq_err event. > > diff --git a/include/trace/events/block.h b/include/trace/events/block.h > index 27170e40e8c9..7f4dfbdf12a6 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,41 @@ 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) > +); > + > +/** > + * block_rq_error - block IO operation error reported by device driver > + * @rq: block operations request > + * @error: status code > + * @nr_bytes: number of completed bytes > + * > + * The block_rq_error tracepoint event indicates that some portion > + * of operation request has failed as reported by the device driver. > + */ > +DEFINE_EVENT(block_rq_completion, block_rq_error, > + > + 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), > > > > -ck > > > > >