On Sat, 2019-04-06 at 20:10 -0400, Josef Bacik wrote: > On Fri, Apr 05, 2019 at 04:55:03PM -0700, Matt Mullins wrote: > > This adds a tracepoint that can both observe the nbd request being sent > > to the server, as well as modify that request , e.g., setting a flag in > > the request that will cause the server to collect detailed tracing data. > > > > The struct request * being handled is included to permit correlation > > with the block tracepoints. > > > > Signed-off-by: Matt Mullins <mmullins@xxxxxx> > > --- > > MAINTAINERS | 1 + > > drivers/block/nbd.c | 5 ++++ > > include/trace/events/nbd.h | 56 ++++++++++++++++++++++++++++++++++++++ > > 3 files changed, 62 insertions(+) > > create mode 100644 include/trace/events/nbd.h > > > > diff --git a/MAINTAINERS b/MAINTAINERS > > index e17ebf70b548..6db583d2b0ea 100644 > > --- a/MAINTAINERS > > +++ b/MAINTAINERS > > @@ -10737,6 +10737,7 @@ L: linux-block@xxxxxxxxxxxxxxx > > L: nbd@xxxxxxxxxxxxxxxx > > F: Documentation/blockdev/nbd.txt > > F: drivers/block/nbd.c > > +F: include/trace/events/nbd.h > > F: include/uapi/linux/nbd.h > > > > NETWORK DROP MONITOR > > diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c > > index 90ba9f4c03f3..7393d04d255c 100644 > > --- a/drivers/block/nbd.c > > +++ b/drivers/block/nbd.c > > @@ -44,6 +44,9 @@ > > #include <linux/nbd-netlink.h> > > #include <net/genetlink.h> > > > > +#define CREATE_TRACE_POINTS > > +#include <trace/events/nbd.h> > > + > > static DEFINE_IDR(nbd_index_idr); > > static DEFINE_MUTEX(nbd_index_mutex); > > static int nbd_total_devices = 0; > > @@ -526,6 +529,8 @@ static int nbd_send_cmd(struct nbd_device *nbd, struct nbd_cmd *cmd, int index) > > handle = nbd_cmd_handle(cmd); > > memcpy(request.handle, &handle, sizeof(handle)); > > > > + trace_nbd_send_request(&request, nbd->index, blk_mq_rq_from_pdu(cmd)); > > + > > Just use the handle, not the pointer. Thanks, Assuming you're talking about the struct request *, we are tracing things through from blk_mq_start_request, which emits tracepoints like DEFINE_EVENT(block_rq, block_rq_issue, TP_PROTO(struct request_queue *q, struct request *rq), We need at least one of the tracepoints to observe a correlation between NBD handle (in this case, embedded in the struct nbd_request) and the struct request. That said, I don't actually mind if they're the hashed kind of pointers, as long as the rest of the block tracepoints do the same...