nvme/perf: only call verify_io when md_size > 0

verify_io is a function pointer, so avoiding the
call altogether is beneficial.  We know that no
verification is possible if md_size == 0, so use
this to determine if the call should be made.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I75f01e4f56aacb0f7babd2342efc6014f886667d

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456249
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Jim Harris 2019-05-29 02:38:50 -07:00
parent e68ea1cebe
commit 2632229b9d

View File

@ -46,6 +46,7 @@
#include "spdk/dif.h"
#include "spdk/util.h"
#include "spdk/log.h"
#include "spdk/likely.h"
#if HAVE_LIBAIO
#include <libaio.h>
@ -548,8 +549,7 @@ nvme_verify_io(struct perf_task *task, struct ns_entry *entry)
struct spdk_dif_error err_blk = {};
int rc;
if (!task->is_read || entry->md_size == 0 ||
(entry->io_flags & SPDK_NVME_IO_FLAGS_PRACT)) {
if (!task->is_read || (entry->io_flags & SPDK_NVME_IO_FLAGS_PRACT)) {
return;
}
@ -917,8 +917,10 @@ task_complete(struct perf_task *task)
spdk_histogram_data_tally(ns_ctx->histogram, tsc_diff);
}
/* add application level verification for end-to-end data protection */
entry->fn_table->verify_io(task, entry);
if (spdk_unlikely(entry->md_size > 0)) {
/* add application level verification for end-to-end data protection */
entry->fn_table->verify_io(task, entry);
}
/*
* is_draining indicates when time has expired for the test run