bdev/nvme: Move up populate_namespaces_cb() in a file

This will reduce the size of the following patches.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I81d7c90d8676a42aff3ffe73932d5612642a4114
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7042
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Shuhei Matsumoto 2021-03-24 19:46:38 +09:00 committed by Tomasz Zawadzki
parent 90f434b9a0
commit cd820331a2

View File

@ -1698,6 +1698,23 @@ aer_cb(void *arg, const struct spdk_nvme_cpl *cpl)
} }
} }
static void
populate_namespaces_cb(struct nvme_async_probe_ctx *ctx, size_t count, int rc)
{
if (ctx->cb_fn) {
ctx->cb_fn(ctx->cb_ctx, count, rc);
}
ctx->namespaces_populated = true;
if (ctx->probe_done) {
/* The probe was already completed, so we need to free the context
* here. This can happen for cases like OCSSD, where we need to
* send additional commands to the SSD after attach.
*/
free(ctx);
}
}
static int static int
nvme_bdev_ctrlr_create(struct spdk_nvme_ctrlr *ctrlr, nvme_bdev_ctrlr_create(struct spdk_nvme_ctrlr *ctrlr,
const char *name, const char *name,
@ -2019,23 +2036,6 @@ bdev_nvme_set_hotplug(bool enabled, uint64_t period_us, spdk_msg_fn cb, void *cb
return 0; return 0;
} }
static void
populate_namespaces_cb(struct nvme_async_probe_ctx *ctx, size_t count, int rc)
{
if (ctx->cb_fn) {
ctx->cb_fn(ctx->cb_ctx, count, rc);
}
ctx->namespaces_populated = true;
if (ctx->probe_done) {
/* The probe was already completed, so we need to free the context
* here. This can happen for cases like OCSSD, where we need to
* send additional commands to the SSD after attach.
*/
free(ctx);
}
}
static void static void
nvme_ctrlr_populate_namespaces_done(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr, nvme_ctrlr_populate_namespaces_done(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr,
struct nvme_async_probe_ctx *ctx) struct nvme_async_probe_ctx *ctx)