diff --git a/include/spdk/nvme.h b/include/spdk/nvme.h index da1e72b345..07186219fd 100644 --- a/include/spdk/nvme.h +++ b/include/spdk/nvme.h @@ -49,9 +49,6 @@ extern "C" { #include "spdk/nvmf_spec.h" #define SPDK_NVME_DEFAULT_RETRY_COUNT (4) -extern int32_t spdk_nvme_retry_count; - - /** * Opaque handle to a controller. Returned by spdk_nvme_probe()'s attach_cb. diff --git a/lib/bdev/nvme/bdev_nvme.c b/lib/bdev/nvme/bdev_nvme.c index 574ebd3cc8..3ae089cbc7 100644 --- a/lib/bdev/nvme/bdev_nvme.c +++ b/lib/bdev/nvme/bdev_nvme.c @@ -1297,6 +1297,7 @@ spdk_bdev_nvme_create(struct spdk_nvme_transport_id *trid, ctx->trid = *trid; spdk_nvme_ctrlr_get_default_ctrlr_opts(&ctx->opts, sizeof(ctx->opts)); + ctx->opts.transport_retry_count = g_opts.retry_count; if (hostnqn) { snprintf(ctx->opts.hostnqn, sizeof(ctx->opts.hostnqn), "%s", hostnqn); @@ -1504,6 +1505,7 @@ bdev_nvme_library_init(void) } spdk_nvme_ctrlr_get_default_ctrlr_opts(&opts, sizeof(opts)); + opts.transport_retry_count = g_opts.retry_count; if (probe_ctx->hostnqn != NULL) { snprintf(opts.hostnqn, sizeof(opts.hostnqn), "%s", probe_ctx->hostnqn); @@ -1559,8 +1561,6 @@ bdev_nvme_library_init(void) rc = -1; } end: - spdk_nvme_retry_count = g_opts.retry_count; - free(probe_ctx); return rc; } @@ -2054,7 +2054,7 @@ bdev_nvme_get_spdk_running_config(FILE *fp) fprintf(fp, "\n" "# The number of attempts per I/O when an I/O fails. Do not include\n" "# this key to get the default behavior.\n"); - fprintf(fp, "RetryCount %d\n", spdk_nvme_retry_count); + fprintf(fp, "RetryCount %d\n", g_opts.retry_count); fprintf(fp, "\n" "# Timeout for each command, in microseconds. If 0, don't track timeouts.\n"); fprintf(fp, "TimeoutUsec %"PRIu64"\n", g_opts.timeout_us); diff --git a/lib/nvme/nvme.c b/lib/nvme/nvme.c index ffb67293a6..5edc1a7d6f 100644 --- a/lib/nvme/nvme.c +++ b/lib/nvme/nvme.c @@ -39,8 +39,6 @@ struct nvme_driver *g_spdk_nvme_driver; pid_t g_spdk_nvme_pid; -int32_t spdk_nvme_retry_count; - /* gross timeout of 180 seconds in milliseconds */ static int g_nvme_driver_timeout_ms = 3 * 60 * 1000; diff --git a/test/nvme/reset/reset.c b/test/nvme/reset/reset.c index 82ad8692c6..e83d557886 100644 --- a/test/nvme/reset/reset.c +++ b/test/nvme/reset/reset.c @@ -610,13 +610,11 @@ associate_workers_with_ns(void) } static int -run_nvme_reset_cycle(int retry_count) +run_nvme_reset_cycle(void) { struct worker_thread *worker; struct ns_worker_ctx *ns_ctx; - spdk_nvme_retry_count = retry_count; - if (work_fn(g_workers) != 0) { return -1; } @@ -700,7 +698,7 @@ int main(int argc, char **argv) printf("Initialization complete. Launching workers.\n"); for (i = 2; i >= 0; i--) { - rc = run_nvme_reset_cycle(i); + rc = run_nvme_reset_cycle(); if (rc != 0) { goto cleanup; } diff --git a/test/unit/lib/nvme/nvme_pcie.c/nvme_pcie_ut.c b/test/unit/lib/nvme/nvme_pcie.c/nvme_pcie_ut.c index ea8edeb1ff..937bd42557 100644 --- a/test/unit/lib/nvme/nvme_pcie.c/nvme_pcie_ut.c +++ b/test/unit/lib/nvme/nvme_pcie.c/nvme_pcie_ut.c @@ -51,8 +51,6 @@ static struct nvme_driver _g_nvme_driver = { }; struct nvme_driver *g_spdk_nvme_driver = &_g_nvme_driver; -int32_t spdk_nvme_retry_count = 1; - struct nvme_request *g_request = NULL; extern bool ut_fail_vtophys; @@ -469,7 +467,6 @@ test_sgl_req(void) req->cmd.opc = SPDK_NVME_OPC_WRITE; req->cmd.cdw10 = 10000; req->cmd.cdw12 = 7 | 0; - spdk_nvme_retry_count = 1; fail_next_sge = true; CU_ASSERT(nvme_qpair_submit_request(&qpair, req) != 0);