Commit de76e810 authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

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: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I9cf5f1f79ea8650b2e82654a0ce770d89e0a06f7

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475920


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent a3dd00ed
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -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