Re: [PATCH bpf-next v2 2/5] nbd: trace sending nbd requests

From: Josef Bacik
Date: Sat Apr 06 2019 - 20:11:03 EST


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,

Josef