summaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorMatt Mullins2019-04-26 20:49:48 +0200
committerAlexei Starovoitov2019-04-27 04:04:19 +0200
commitea106722c76f08002b69a6983ed84dc18958ba48 (patch)
tree740b273cebfa9af47c98530803177034d6abb851 /drivers/block
parentbpf: add writable context for raw tracepoints (diff)
downloadkernel-qcow2-linux-ea106722c76f08002b69a6983ed84dc18958ba48.tar.gz
kernel-qcow2-linux-ea106722c76f08002b69a6983ed84dc18958ba48.tar.xz
kernel-qcow2-linux-ea106722c76f08002b69a6983ed84dc18958ba48.zip
nbd: trace sending nbd requests
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@fb.com> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/nbd.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 92b8aafb8bb4..24cc10d1f0b4 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));
+
dev_dbg(nbd_to_dev(nbd), "request %p: sending control (%s@%llu,%uB)\n",
req, nbdcmd_to_ascii(type),
(unsigned long long)blk_rq_pos(req) << 9, blk_rq_bytes(req));