summaryrefslogtreecommitdiff
path: root/drivers/nvme/host/trace.c
diff options
context:
space:
mode:
authorKeith Busch <keith.busch@intel.com>2018-06-30 01:50:03 +0300
committerChristoph Hellwig <hch@lst.de>2018-07-24 16:55:48 +0300
commit6268953e8977a23ca7512a2921e82a5d9252ec01 (patch)
tree069eabf096b12e5d72844ebe9a6c9911d3eefdda /drivers/nvme/host/trace.c
parentb80a55e246a1b817cb254d79d077f364a2419578 (diff)
downloadlinux-6268953e8977a23ca7512a2921e82a5d9252ec01.tar.xz
nvme: add disk name to trace events
This will print the disk name to the nvme event trace for io requests so a user can better distinguish traffic to different disks. This can be used to create disk based filters. For example, to see only nvme0n2 traffic: echo "disk == \"nvme0n2\"" > /sys/kernel/debug/tracing/events/nvme/filter Signed-off-by: Keith Busch <keith.busch@intel.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> [hch: turned __assign_disk_name into an inline function] Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/nvme/host/trace.c')
-rw-r--r--drivers/nvme/host/trace.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/nvme/host/trace.c b/drivers/nvme/host/trace.c
index 41944bbef835..25b0e310f4a8 100644
--- a/drivers/nvme/host/trace.c
+++ b/drivers/nvme/host/trace.c
@@ -128,3 +128,14 @@ const char *nvme_trace_parse_nvm_cmd(struct trace_seq *p,
return nvme_trace_common(p, cdw10);
}
}
+
+const char *nvme_trace_disk_name(struct trace_seq *p, char *name)
+{
+ const char *ret = trace_seq_buffer_ptr(p);
+
+ if (*name)
+ trace_seq_printf(p, "disk=%s, ", name);
+ trace_seq_putc(p, 0);
+
+ return ret;
+}