diff --git a/module/bdev/nvme/bdev_nvme.c b/module/bdev/nvme/bdev_nvme.c index 573f68d5db..ffd8426021 100644 --- a/module/bdev/nvme/bdev_nvme.c +++ b/module/bdev/nvme/bdev_nvme.c @@ -1214,17 +1214,17 @@ bdev_nvme_create_bdevs(struct nvme_async_probe_ctx *ctx) continue; } assert(nvme_bdev->id == nsid); - if (j < *ctx->count) { + if (j < ctx->count) { ctx->names[j] = nvme_bdev->disk.name; j++; } else { SPDK_ERRLOG("Maximum number of namespaces supported per NVMe controller is %du. Unable to return all names of created bdevs\n", - *ctx->count); + ctx->count); return -1; } } - *ctx->count = j; + ctx->count = j; return 0; } @@ -1254,7 +1254,7 @@ connect_attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid, end: if (ctx->cb_fn) { - ctx->cb_fn(ctx->cb_ctx, rc); + ctx->cb_fn(ctx->cb_ctx, ctx->count, rc); } } @@ -1279,7 +1279,7 @@ spdk_bdev_nvme_create(struct spdk_nvme_transport_id *trid, struct spdk_nvme_host_id *hostid, const char *base_name, const char **names, - uint32_t *count, + uint32_t count, const char *hostnqn, uint32_t prchk_flags, spdk_bdev_create_nvme_fn cb_fn, diff --git a/module/bdev/nvme/bdev_nvme.h b/module/bdev/nvme/bdev_nvme.h index 4904084495..75d5ed9e58 100644 --- a/module/bdev/nvme/bdev_nvme.h +++ b/module/bdev/nvme/bdev_nvme.h @@ -70,7 +70,7 @@ int spdk_bdev_nvme_create(struct spdk_nvme_transport_id *trid, struct spdk_nvme_host_id *hostid, const char *base_name, const char **names, - uint32_t *count, + uint32_t count, const char *hostnqn, uint32_t prchk_flags, spdk_bdev_create_nvme_fn cb_fn, diff --git a/module/bdev/nvme/bdev_nvme_rpc.c b/module/bdev/nvme/bdev_nvme_rpc.c index 409e52dae5..6ef9ff233c 100644 --- a/module/bdev/nvme/bdev_nvme_rpc.c +++ b/module/bdev/nvme/bdev_nvme_rpc.c @@ -216,7 +216,7 @@ struct rpc_bdev_nvme_attach_controller_ctx { }; static void -spdk_rpc_bdev_nvme_attach_controller_done(void *cb_ctx, int rc) +spdk_rpc_bdev_nvme_attach_controller_done(void *cb_ctx, size_t bdev_count, int rc) { struct rpc_bdev_nvme_attach_controller_ctx *ctx = cb_ctx; struct spdk_jsonrpc_request *request = ctx->request; @@ -230,7 +230,7 @@ spdk_rpc_bdev_nvme_attach_controller_done(void *cb_ctx, int rc) w = spdk_jsonrpc_begin_result(request); spdk_json_write_array_begin(w); - for (i = 0; i < ctx->count; i++) { + for (i = 0; i < bdev_count; i++) { spdk_json_write_string(w, ctx->names[i]); } spdk_json_write_array_end(w); @@ -317,7 +317,7 @@ spdk_rpc_bdev_nvme_attach_controller(struct spdk_jsonrpc_request *request, ctx->request = request; ctx->count = NVME_MAX_BDEVS_PER_RPC; - rc = spdk_bdev_nvme_create(&trid, &hostid, ctx->req.name, ctx->names, &ctx->count, ctx->req.hostnqn, + rc = spdk_bdev_nvme_create(&trid, &hostid, ctx->req.name, ctx->names, ctx->count, ctx->req.hostnqn, prchk_flags, spdk_rpc_bdev_nvme_attach_controller_done, ctx); if (rc) { spdk_jsonrpc_send_error_response(request, rc, spdk_strerror(-rc)); diff --git a/module/bdev/nvme/common.h b/module/bdev/nvme/common.h index 7fcf134b6d..7be0d943ed 100644 --- a/module/bdev/nvme/common.h +++ b/module/bdev/nvme/common.h @@ -81,13 +81,13 @@ struct nvme_bdev { struct spdk_nvme_ns *ns; }; -typedef void (*spdk_bdev_create_nvme_fn)(void *ctx, int rc); +typedef void (*spdk_bdev_create_nvme_fn)(void *ctx, size_t bdev_count, int rc); struct nvme_async_probe_ctx { struct spdk_nvme_probe_ctx *probe_ctx; const char *base_name; const char **names; - uint32_t *count; + uint32_t count; uint32_t prchk_flags; struct spdk_poller *poller; struct spdk_nvme_transport_id trid;