diff mbox series

[01/17] block/nvme: Avoid further processing if trace event not enabled

Message ID 20200625184838.28172-2-philmd@redhat.com
State New
Headers show
Series [01/17] block/nvme: Avoid further processing if trace event not enabled | expand

Commit Message

Philippe Mathieu-Daudé June 25, 2020, 6:48 p.m. UTC
Avoid further processing if TRACE_NVME_SUBMIT_COMMAND_RAW is
not enabled.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 block/nvme.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/block/nvme.c b/block/nvme.c
index eb2f54dd9d..1e5b40f61c 100644
--- a/block/nvme.c
+++ b/block/nvme.c
@@ -367,6 +367,9 @@  static void nvme_trace_command(const NvmeCmd *cmd)
 {
     int i;
 
+    if (!trace_event_get_state_backends(TRACE_NVME_SUBMIT_COMMAND_RAW)) {
+        return;
+    }
     for (i = 0; i < 8; ++i) {
         uint8_t *cmdp = (uint8_t *)cmd + i * 8;
         trace_nvme_submit_command_raw(cmdp[0], cmdp[1], cmdp[2], cmdp[3],