bdev/nvme: simplify bdev_nvme_populate_namespaces

There's no need to support cb_fn/cb_arg parameters
to bdev_nvme_populate_namespaces.  Just have it
call populate_namespaces_cb() directly.

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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475920
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Jim Harris 2019-11-26 10:52:55 -07:00 committed by Tomasz Zawadzki
parent a3dd00ed97
commit de76e8105f

View File

@ -1336,10 +1336,8 @@ spdk_bdev_nvme_set_hotplug(bool enabled, uint64_t period_us, spdk_msg_fn cb, voi
}
static void
populate_namespaces_cb(void *cb_arg, size_t count, int rc)
populate_namespaces_cb(struct nvme_async_probe_ctx *ctx, size_t count, int rc)
{
struct nvme_async_probe_ctx *ctx = cb_arg;
if (ctx->cb_fn) {
ctx->cb_fn(ctx->cb_ctx, count, rc);
}
@ -1348,8 +1346,7 @@ populate_namespaces_cb(void *cb_arg, size_t count, int rc)
}
static void
bdev_nvme_populate_namespaces(struct nvme_async_probe_ctx *ctx, spdk_bdev_create_nvme_fn cb_fn,
void *cb_arg)
bdev_nvme_populate_namespaces(struct nvme_async_probe_ctx *ctx)
{
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr;
struct nvme_bdev_ns *ns;
@ -1381,13 +1378,13 @@ bdev_nvme_populate_namespaces(struct nvme_async_probe_ctx *ctx, spdk_bdev_create
} else {
SPDK_ERRLOG("Maximum number of namespaces supported per NVMe controller is %du. Unable to return all names of created bdevs\n",
ctx->count);
cb_fn(cb_arg, 0, -ERANGE);
populate_namespaces_cb(ctx, 0, -ERANGE);
return;
}
}
}
cb_fn(cb_arg, j, 0);
populate_namespaces_cb(ctx, j, 0);
}
static void
@ -1409,7 +1406,7 @@ connect_attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
return;
}
bdev_nvme_populate_namespaces(ctx, populate_namespaces_cb, ctx);
bdev_nvme_populate_namespaces(ctx);
}
static int