bdev/nvme: Rename nvme_bdev_ns by nvme_ns
This object will be aggregated by the upper layer object nvme_bdev. Hence based on the new naming rule, rename nvme_bdev_ns by nvme_ns. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I96a70213b29fb53437acd080a0787ec9f5a6759a Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8379 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
c710c9acbe
commit
c4626aa486
@ -192,9 +192,9 @@ static int bdev_nvme_failover(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr, bool remo
|
||||
static void remove_cb(void *cb_ctx, struct spdk_nvme_ctrlr *ctrlr);
|
||||
|
||||
typedef void (*populate_namespace_fn)(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr,
|
||||
struct nvme_bdev_ns *nvme_ns, struct nvme_async_probe_ctx *ctx);
|
||||
struct nvme_ns *nvme_ns, struct nvme_async_probe_ctx *ctx);
|
||||
static void nvme_ctrlr_populate_standard_namespace(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr,
|
||||
struct nvme_bdev_ns *nvme_ns, struct nvme_async_probe_ctx *ctx);
|
||||
struct nvme_ns *nvme_ns, struct nvme_async_probe_ctx *ctx);
|
||||
|
||||
static populate_namespace_fn g_populate_namespace_fn[] = {
|
||||
NULL,
|
||||
@ -202,8 +202,8 @@ static populate_namespace_fn g_populate_namespace_fn[] = {
|
||||
bdev_ocssd_populate_namespace,
|
||||
};
|
||||
|
||||
typedef void (*depopulate_namespace_fn)(struct nvme_bdev_ns *nvme_ns);
|
||||
static void nvme_ctrlr_depopulate_standard_namespace(struct nvme_bdev_ns *nvme_ns);
|
||||
typedef void (*depopulate_namespace_fn)(struct nvme_ns *nvme_ns);
|
||||
static void nvme_ctrlr_depopulate_standard_namespace(struct nvme_ns *nvme_ns);
|
||||
|
||||
static depopulate_namespace_fn g_depopulate_namespace_fn[] = {
|
||||
NULL,
|
||||
@ -212,9 +212,9 @@ static depopulate_namespace_fn g_depopulate_namespace_fn[] = {
|
||||
};
|
||||
|
||||
typedef void (*config_json_namespace_fn)(struct spdk_json_write_ctx *w,
|
||||
struct nvme_bdev_ns *nvme_ns);
|
||||
struct nvme_ns *nvme_ns);
|
||||
static void nvme_ctrlr_config_json_standard_namespace(struct spdk_json_write_ctx *w,
|
||||
struct nvme_bdev_ns *nvme_ns);
|
||||
struct nvme_ns *nvme_ns);
|
||||
|
||||
static config_json_namespace_fn g_config_json_namespace_fn[] = {
|
||||
NULL,
|
||||
@ -360,7 +360,7 @@ static int
|
||||
bdev_nvme_destruct(void *ctx)
|
||||
{
|
||||
struct nvme_bdev *nvme_disk = ctx;
|
||||
struct nvme_bdev_ns *nvme_ns = nvme_disk->nvme_ns;
|
||||
struct nvme_ns *nvme_ns = nvme_disk->nvme_ns;
|
||||
|
||||
pthread_mutex_lock(&nvme_ns->ctrlr->mutex);
|
||||
|
||||
@ -961,7 +961,7 @@ static bool
|
||||
bdev_nvme_io_type_supported(void *ctx, enum spdk_bdev_io_type io_type)
|
||||
{
|
||||
struct nvme_bdev *nbdev = ctx;
|
||||
struct nvme_bdev_ns *nvme_ns;
|
||||
struct nvme_ns *nvme_ns;
|
||||
struct spdk_nvme_ns *ns;
|
||||
struct spdk_nvme_ctrlr *ctrlr;
|
||||
const struct spdk_nvme_ctrlr_data *cdata;
|
||||
@ -1190,7 +1190,7 @@ static int
|
||||
bdev_nvme_dump_info_json(void *ctx, struct spdk_json_write_ctx *w)
|
||||
{
|
||||
struct nvme_bdev *nvme_bdev = ctx;
|
||||
struct nvme_bdev_ns *nvme_ns;
|
||||
struct nvme_ns *nvme_ns;
|
||||
struct spdk_nvme_ns *ns;
|
||||
struct spdk_nvme_ctrlr *ctrlr;
|
||||
const struct spdk_nvme_ctrlr_data *cdata;
|
||||
@ -1455,7 +1455,7 @@ nvme_disk_create(struct spdk_bdev *disk, const char *base_name,
|
||||
}
|
||||
|
||||
static int
|
||||
nvme_bdev_create(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr, struct nvme_bdev_ns *nvme_ns)
|
||||
nvme_bdev_create(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr, struct nvme_ns *nvme_ns)
|
||||
{
|
||||
struct nvme_bdev *bdev;
|
||||
int rc;
|
||||
@ -1500,7 +1500,7 @@ bdev_nvme_compare_ns(struct spdk_nvme_ns *ns1, struct spdk_nvme_ns *ns2)
|
||||
|
||||
static void
|
||||
nvme_ctrlr_populate_standard_namespace(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr,
|
||||
struct nvme_bdev_ns *nvme_ns, struct nvme_async_probe_ctx *ctx)
|
||||
struct nvme_ns *nvme_ns, struct nvme_async_probe_ctx *ctx)
|
||||
{
|
||||
struct spdk_nvme_ctrlr *ctrlr = nvme_bdev_ctrlr->ctrlr;
|
||||
struct spdk_nvme_ns *ns;
|
||||
@ -1616,7 +1616,7 @@ timeout_cb(void *cb_arg, struct spdk_nvme_ctrlr *ctrlr,
|
||||
}
|
||||
|
||||
static void
|
||||
nvme_ctrlr_depopulate_standard_namespace(struct nvme_bdev_ns *nvme_ns)
|
||||
nvme_ctrlr_depopulate_standard_namespace(struct nvme_ns *nvme_ns)
|
||||
{
|
||||
struct nvme_bdev *bdev;
|
||||
|
||||
@ -1629,21 +1629,21 @@ nvme_ctrlr_depopulate_standard_namespace(struct nvme_bdev_ns *nvme_ns)
|
||||
}
|
||||
|
||||
static void
|
||||
nvme_ctrlr_populate_namespace(struct nvme_bdev_ctrlr *ctrlr, struct nvme_bdev_ns *nvme_ns,
|
||||
nvme_ctrlr_populate_namespace(struct nvme_bdev_ctrlr *ctrlr, struct nvme_ns *nvme_ns,
|
||||
struct nvme_async_probe_ctx *ctx)
|
||||
{
|
||||
g_populate_namespace_fn[nvme_ns->type](ctrlr, nvme_ns, ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
nvme_ctrlr_depopulate_namespace(struct nvme_bdev_ctrlr *ctrlr, struct nvme_bdev_ns *nvme_ns)
|
||||
nvme_ctrlr_depopulate_namespace(struct nvme_bdev_ctrlr *ctrlr, struct nvme_ns *nvme_ns)
|
||||
{
|
||||
g_depopulate_namespace_fn[nvme_ns->type](nvme_ns);
|
||||
}
|
||||
|
||||
void
|
||||
nvme_ctrlr_populate_namespace_done(struct nvme_async_probe_ctx *ctx,
|
||||
struct nvme_bdev_ns *nvme_ns, int rc)
|
||||
struct nvme_ns *nvme_ns, int rc)
|
||||
{
|
||||
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr = nvme_ns->ctrlr;
|
||||
|
||||
@ -1670,7 +1670,7 @@ nvme_ctrlr_populate_namespaces(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr,
|
||||
struct nvme_async_probe_ctx *ctx)
|
||||
{
|
||||
struct spdk_nvme_ctrlr *ctrlr = nvme_bdev_ctrlr->ctrlr;
|
||||
struct nvme_bdev_ns *nvme_ns;
|
||||
struct nvme_ns *nvme_ns;
|
||||
struct spdk_nvme_ns *ns;
|
||||
struct nvme_bdev *bdev;
|
||||
uint32_t i;
|
||||
@ -1691,7 +1691,7 @@ nvme_ctrlr_populate_namespaces(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr,
|
||||
nvme_ns = nvme_bdev_ctrlr->namespaces[i];
|
||||
ns_is_active = spdk_nvme_ctrlr_is_active_ns(ctrlr, nsid);
|
||||
|
||||
if (nvme_ns->populated && ns_is_active && nvme_ns->type == NVME_BDEV_NS_STANDARD) {
|
||||
if (nvme_ns->populated && ns_is_active && nvme_ns->type == NVME_NS_STANDARD) {
|
||||
/* NS is still there but attributes may have changed */
|
||||
ns = spdk_nvme_ctrlr_get_ns(ctrlr, nsid);
|
||||
num_sectors = spdk_nvme_ns_get_num_sectors(ns);
|
||||
@ -1715,9 +1715,9 @@ nvme_ctrlr_populate_namespaces(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr,
|
||||
nvme_ns->id = nsid;
|
||||
nvme_ns->ctrlr = nvme_bdev_ctrlr;
|
||||
if (spdk_nvme_ctrlr_is_ocssd_supported(ctrlr)) {
|
||||
nvme_ns->type = NVME_BDEV_NS_OCSSD;
|
||||
nvme_ns->type = NVME_NS_OCSSD;
|
||||
} else {
|
||||
nvme_ns->type = NVME_BDEV_NS_STANDARD;
|
||||
nvme_ns->type = NVME_NS_STANDARD;
|
||||
}
|
||||
|
||||
nvme_ns->bdev = NULL;
|
||||
@ -1751,7 +1751,7 @@ static void
|
||||
nvme_ctrlr_depopulate_namespaces(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr)
|
||||
{
|
||||
uint32_t i;
|
||||
struct nvme_bdev_ns *nvme_ns;
|
||||
struct nvme_ns *nvme_ns;
|
||||
|
||||
for (i = 0; i < nvme_bdev_ctrlr->num_ns; i++) {
|
||||
uint32_t nsid = i + 1;
|
||||
@ -1844,7 +1844,7 @@ nvme_bdev_ctrlr_create(struct spdk_nvme_ctrlr *ctrlr,
|
||||
|
||||
num_ns = spdk_nvme_ctrlr_get_num_ns(ctrlr);
|
||||
if (num_ns != 0) {
|
||||
nvme_bdev_ctrlr->namespaces = calloc(num_ns, sizeof(struct nvme_bdev_ns *));
|
||||
nvme_bdev_ctrlr->namespaces = calloc(num_ns, sizeof(struct nvme_ns *));
|
||||
if (!nvme_bdev_ctrlr->namespaces) {
|
||||
SPDK_ERRLOG("Failed to allocate block namespaces pointer\n");
|
||||
rc = -ENOMEM;
|
||||
@ -1852,7 +1852,7 @@ nvme_bdev_ctrlr_create(struct spdk_nvme_ctrlr *ctrlr,
|
||||
}
|
||||
|
||||
for (i = 0; i < num_ns; i++) {
|
||||
nvme_bdev_ctrlr->namespaces[i] = calloc(1, sizeof(struct nvme_bdev_ns));
|
||||
nvme_bdev_ctrlr->namespaces[i] = calloc(1, sizeof(struct nvme_ns));
|
||||
if (nvme_bdev_ctrlr->namespaces[i] == NULL) {
|
||||
SPDK_ERRLOG("Failed to allocate block namespace struct\n");
|
||||
rc = -ENOMEM;
|
||||
@ -2114,7 +2114,7 @@ static void
|
||||
nvme_ctrlr_populate_namespaces_done(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr,
|
||||
struct nvme_async_probe_ctx *ctx)
|
||||
{
|
||||
struct nvme_bdev_ns *nvme_ns;
|
||||
struct nvme_ns *nvme_ns;
|
||||
struct nvme_bdev *nvme_bdev;
|
||||
uint32_t i, nsid;
|
||||
size_t j;
|
||||
@ -2135,7 +2135,7 @@ nvme_ctrlr_populate_namespaces_done(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr,
|
||||
assert(nvme_ns->id == nsid);
|
||||
nvme_bdev = nvme_ns->bdev;
|
||||
if (nvme_bdev == NULL) {
|
||||
assert(nvme_ns->type == NVME_BDEV_NS_OCSSD);
|
||||
assert(nvme_ns->type == NVME_NS_OCSSD);
|
||||
continue;
|
||||
}
|
||||
if (j < ctx->count) {
|
||||
@ -2189,7 +2189,7 @@ bdev_nvme_compare_namespaces(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr,
|
||||
struct spdk_nvme_ctrlr *new_ctrlr)
|
||||
{
|
||||
uint32_t i, nsid;
|
||||
struct nvme_bdev_ns *nvme_ns;
|
||||
struct nvme_ns *nvme_ns;
|
||||
struct spdk_nvme_ns *new_ns;
|
||||
|
||||
if (spdk_nvme_ctrlr_get_num_ns(new_ctrlr) != nvme_bdev_ctrlr->num_ns) {
|
||||
@ -3397,13 +3397,13 @@ bdev_nvme_abort(struct nvme_ctrlr_channel *ctrlr_ch, struct nvme_bdev_io *bio,
|
||||
|
||||
static void
|
||||
nvme_ctrlr_config_json_standard_namespace(struct spdk_json_write_ctx *w,
|
||||
struct nvme_bdev_ns *nvme_ns)
|
||||
struct nvme_ns *nvme_ns)
|
||||
{
|
||||
/* nop */
|
||||
}
|
||||
|
||||
static void
|
||||
nvme_namespace_config_json(struct spdk_json_write_ctx *w, struct nvme_bdev_ns *nvme_ns)
|
||||
nvme_namespace_config_json(struct spdk_json_write_ctx *w, struct nvme_ns *nvme_ns)
|
||||
{
|
||||
g_config_json_namespace_fn[nvme_ns->type](w, nvme_ns);
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ struct ocssd_bdev_ctrlr {
|
||||
};
|
||||
|
||||
static struct bdev_ocssd_ns *
|
||||
bdev_ocssd_get_ns_from_nvme(struct nvme_bdev_ns *nvme_ns)
|
||||
bdev_ocssd_get_ns_from_nvme(struct nvme_ns *nvme_ns)
|
||||
{
|
||||
return nvme_ns->type_ctx;
|
||||
}
|
||||
@ -139,7 +139,7 @@ bdev_ocssd_config_json(struct spdk_json_write_ctx *w)
|
||||
}
|
||||
|
||||
void
|
||||
bdev_ocssd_namespace_config_json(struct spdk_json_write_ctx *w, struct nvme_bdev_ns *nvme_ns)
|
||||
bdev_ocssd_namespace_config_json(struct spdk_json_write_ctx *w, struct nvme_ns *nvme_ns)
|
||||
{
|
||||
struct nvme_bdev *nvme_bdev;
|
||||
|
||||
@ -229,7 +229,7 @@ bdev_ocssd_destruct(void *ctx)
|
||||
{
|
||||
struct ocssd_bdev *ocssd_bdev = ctx;
|
||||
struct nvme_bdev *nvme_bdev = &ocssd_bdev->nvme_bdev;
|
||||
struct nvme_bdev_ns *nvme_ns = nvme_bdev->nvme_ns;
|
||||
struct nvme_ns *nvme_ns = nvme_bdev->nvme_ns;
|
||||
|
||||
pthread_mutex_lock(&nvme_ns->ctrlr->mutex);
|
||||
|
||||
@ -913,7 +913,7 @@ bdev_ocssd_get_io_channel(void *ctx)
|
||||
}
|
||||
|
||||
static void
|
||||
bdev_ocssd_free_namespace(struct nvme_bdev_ns *nvme_ns)
|
||||
bdev_ocssd_free_namespace(struct nvme_ns *nvme_ns)
|
||||
{
|
||||
struct nvme_bdev *bdev;
|
||||
|
||||
@ -929,7 +929,7 @@ bdev_ocssd_free_namespace(struct nvme_bdev_ns *nvme_ns)
|
||||
}
|
||||
|
||||
static void
|
||||
bdev_ocssd_push_media_events(struct nvme_bdev_ns *nvme_ns,
|
||||
bdev_ocssd_push_media_events(struct nvme_ns *nvme_ns,
|
||||
struct spdk_ocssd_chunk_notification_entry *chunk_entry)
|
||||
{
|
||||
struct bdev_ocssd_ns *ocssd_ns = bdev_ocssd_get_ns_from_nvme(nvme_ns);
|
||||
@ -975,7 +975,7 @@ bdev_ocssd_push_media_events(struct nvme_bdev_ns *nvme_ns,
|
||||
}
|
||||
|
||||
static void
|
||||
bdev_ocssd_notify_media_management(struct nvme_bdev_ns *nvme_ns)
|
||||
bdev_ocssd_notify_media_management(struct nvme_ns *nvme_ns)
|
||||
{
|
||||
struct nvme_bdev *nvme_bdev;
|
||||
|
||||
@ -988,7 +988,7 @@ bdev_ocssd_notify_media_management(struct nvme_bdev_ns *nvme_ns)
|
||||
static void
|
||||
bdev_ocssd_chunk_notification_cb(void *ctx, const struct spdk_nvme_cpl *cpl)
|
||||
{
|
||||
struct nvme_bdev_ns *nvme_ns = ctx;
|
||||
struct nvme_ns *nvme_ns = ctx;
|
||||
struct bdev_ocssd_ns *ocssd_ns = bdev_ocssd_get_ns_from_nvme(nvme_ns);
|
||||
struct spdk_ocssd_chunk_notification_entry *chunk_entry;
|
||||
size_t chunk_id;
|
||||
@ -1038,7 +1038,7 @@ static int
|
||||
bdev_ocssd_poll_mm(void *ctx)
|
||||
{
|
||||
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr = ctx;
|
||||
struct nvme_bdev_ns *nvme_ns;
|
||||
struct nvme_ns *nvme_ns;
|
||||
struct bdev_ocssd_ns *ocssd_ns;
|
||||
uint32_t nsid;
|
||||
int rc;
|
||||
@ -1076,7 +1076,7 @@ void
|
||||
bdev_ocssd_handle_chunk_notification(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr)
|
||||
{
|
||||
struct bdev_ocssd_ns *ocssd_ns;
|
||||
struct nvme_bdev_ns *nvme_ns;
|
||||
struct nvme_ns *nvme_ns;
|
||||
uint32_t nsid;
|
||||
|
||||
for (nsid = 0; nsid < nvme_bdev_ctrlr->num_ns; ++nsid) {
|
||||
@ -1099,7 +1099,7 @@ static struct spdk_bdev_fn_table ocssdlib_fn_table = {
|
||||
|
||||
struct bdev_ocssd_create_ctx {
|
||||
struct ocssd_bdev *ocssd_bdev;
|
||||
struct nvme_bdev_ns *nvme_ns;
|
||||
struct nvme_ns *nvme_ns;
|
||||
bdev_ocssd_create_cb cb_fn;
|
||||
void *cb_arg;
|
||||
uint64_t chunk_offset;
|
||||
@ -1129,7 +1129,7 @@ bdev_ocssd_register_bdev(void *ctx)
|
||||
{
|
||||
struct bdev_ocssd_create_ctx *create_ctx = ctx;
|
||||
struct nvme_bdev *nvme_bdev = &create_ctx->ocssd_bdev->nvme_bdev;
|
||||
struct nvme_bdev_ns *nvme_ns = create_ctx->nvme_ns;
|
||||
struct nvme_ns *nvme_ns = create_ctx->nvme_ns;
|
||||
int rc;
|
||||
|
||||
rc = spdk_bdev_register(&nvme_bdev->disk);
|
||||
@ -1253,7 +1253,7 @@ bdev_ocssd_create_bdev(const char *ctrlr_name, const char *bdev_name, uint32_t n
|
||||
struct nvme_bdev *nvme_bdev = NULL;
|
||||
struct ocssd_bdev *ocssd_bdev = NULL;
|
||||
struct spdk_nvme_ns *ns;
|
||||
struct nvme_bdev_ns *nvme_ns;
|
||||
struct nvme_ns *nvme_ns;
|
||||
struct bdev_ocssd_ns *ocssd_ns;
|
||||
struct spdk_ocssd_geometry_data *geometry;
|
||||
int rc = 0;
|
||||
@ -1411,7 +1411,7 @@ bdev_ocssd_delete_bdev(const char *bdev_name, bdev_ocssd_delete_cb cb_fn, void *
|
||||
|
||||
struct bdev_ocssd_populate_ns_ctx {
|
||||
struct nvme_async_probe_ctx *nvme_ctx;
|
||||
struct nvme_bdev_ns *nvme_ns;
|
||||
struct nvme_ns *nvme_ns;
|
||||
};
|
||||
|
||||
static void
|
||||
@ -1419,7 +1419,7 @@ bdev_ocssd_geometry_cb(void *_ctx, const struct spdk_nvme_cpl *cpl)
|
||||
{
|
||||
struct bdev_ocssd_populate_ns_ctx *ctx = _ctx;
|
||||
struct nvme_async_probe_ctx *nvme_ctx = ctx->nvme_ctx;
|
||||
struct nvme_bdev_ns *nvme_ns = ctx->nvme_ns;
|
||||
struct nvme_ns *nvme_ns = ctx->nvme_ns;
|
||||
struct bdev_ocssd_ns *ocssd_ns = bdev_ocssd_get_ns_from_nvme(nvme_ns);
|
||||
const struct spdk_ocssd_geometry_data *geometry = &ocssd_ns->geometry;
|
||||
struct bdev_ocssd_lba_offsets *offsets = &ocssd_ns->lba_offsets;
|
||||
@ -1445,7 +1445,7 @@ bdev_ocssd_geometry_cb(void *_ctx, const struct spdk_nvme_cpl *cpl)
|
||||
|
||||
void
|
||||
bdev_ocssd_populate_namespace(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr,
|
||||
struct nvme_bdev_ns *nvme_ns,
|
||||
struct nvme_ns *nvme_ns,
|
||||
struct nvme_async_probe_ctx *nvme_ctx)
|
||||
{
|
||||
struct bdev_ocssd_ns *ocssd_ns;
|
||||
@ -1497,7 +1497,7 @@ error:
|
||||
}
|
||||
|
||||
void
|
||||
bdev_ocssd_depopulate_namespace(struct nvme_bdev_ns *nvme_ns)
|
||||
bdev_ocssd_depopulate_namespace(struct nvme_ns *nvme_ns)
|
||||
{
|
||||
struct bdev_ocssd_ns *ocssd_ns;
|
||||
|
||||
|
@ -45,10 +45,10 @@ void bdev_ocssd_create_bdev(const char *ctrlr_name, const char *bdev_name, uint3
|
||||
void bdev_ocssd_delete_bdev(const char *bdev_name, bdev_ocssd_delete_cb cb_fn, void *cb_arg);
|
||||
|
||||
void bdev_ocssd_populate_namespace(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr,
|
||||
struct nvme_bdev_ns *nvme_ns,
|
||||
struct nvme_ns *nvme_ns,
|
||||
struct nvme_async_probe_ctx *ctx);
|
||||
void bdev_ocssd_depopulate_namespace(struct nvme_bdev_ns *nvme_ns);
|
||||
void bdev_ocssd_namespace_config_json(struct spdk_json_write_ctx *w, struct nvme_bdev_ns *nvme_ns);
|
||||
void bdev_ocssd_depopulate_namespace(struct nvme_ns *nvme_ns);
|
||||
void bdev_ocssd_namespace_config_json(struct spdk_json_write_ctx *w, struct nvme_ns *nvme_ns);
|
||||
|
||||
int bdev_ocssd_create_io_channel(struct nvme_ctrlr_channel *ioch);
|
||||
void bdev_ocssd_destroy_io_channel(struct nvme_ctrlr_channel *ioch);
|
||||
|
@ -194,7 +194,7 @@ nvme_bdev_ctrlr_release(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr)
|
||||
}
|
||||
|
||||
void
|
||||
nvme_ctrlr_depopulate_namespace_done(struct nvme_bdev_ns *nvme_ns)
|
||||
nvme_ctrlr_depopulate_namespace_done(struct nvme_ns *nvme_ns)
|
||||
{
|
||||
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr = nvme_ns->ctrlr;
|
||||
|
||||
|
@ -46,15 +46,15 @@ extern bool g_bdev_nvme_module_finish;
|
||||
|
||||
#define NVME_MAX_CONTROLLERS 1024
|
||||
|
||||
enum nvme_bdev_ns_type {
|
||||
NVME_BDEV_NS_UNKNOWN = 0,
|
||||
NVME_BDEV_NS_STANDARD = 1,
|
||||
NVME_BDEV_NS_OCSSD = 2,
|
||||
enum nvme_ns_type {
|
||||
NVME_NS_UNKNOWN = 0,
|
||||
NVME_NS_STANDARD = 1,
|
||||
NVME_NS_OCSSD = 2,
|
||||
};
|
||||
|
||||
struct nvme_bdev_ns {
|
||||
struct nvme_ns {
|
||||
uint32_t id;
|
||||
enum nvme_bdev_ns_type type;
|
||||
enum nvme_ns_type type;
|
||||
/** Marks whether this data structure has its bdevs
|
||||
* populated for the associated namespace. It is used
|
||||
* to keep track if we need manage the populated
|
||||
@ -98,7 +98,7 @@ struct nvme_bdev_ctrlr {
|
||||
uint32_t prchk_flags;
|
||||
uint32_t num_ns;
|
||||
/** Array of pointers to namespaces indexed by nsid - 1 */
|
||||
struct nvme_bdev_ns **namespaces;
|
||||
struct nvme_ns **namespaces;
|
||||
|
||||
struct spdk_opal_dev *opal_dev;
|
||||
|
||||
@ -119,7 +119,7 @@ struct nvme_bdev_ctrlr {
|
||||
|
||||
struct nvme_bdev {
|
||||
struct spdk_bdev disk;
|
||||
struct nvme_bdev_ns *nvme_ns;
|
||||
struct nvme_ns *nvme_ns;
|
||||
bool opal;
|
||||
};
|
||||
|
||||
@ -163,8 +163,8 @@ struct nvme_ctrlr_channel {
|
||||
};
|
||||
|
||||
void nvme_ctrlr_populate_namespace_done(struct nvme_async_probe_ctx *ctx,
|
||||
struct nvme_bdev_ns *nvme_ns, int rc);
|
||||
void nvme_ctrlr_depopulate_namespace_done(struct nvme_bdev_ns *nvme_ns);
|
||||
struct nvme_ns *nvme_ns, int rc);
|
||||
void nvme_ctrlr_depopulate_namespace_done(struct nvme_ns *nvme_ns);
|
||||
|
||||
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr_get(const struct spdk_nvme_transport_id *trid);
|
||||
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr_get_by_name(const char *name);
|
||||
|
@ -201,12 +201,12 @@ DEFINE_STUB(spdk_opal_dev_construct, struct spdk_opal_dev *, (struct spdk_nvme_c
|
||||
DEFINE_STUB_V(spdk_opal_dev_destruct, (struct spdk_opal_dev *dev));
|
||||
|
||||
DEFINE_STUB_V(bdev_ocssd_populate_namespace, (struct nvme_bdev_ctrlr *nvme_bdev_ctrlr,
|
||||
struct nvme_bdev_ns *nvme_ns, struct nvme_async_probe_ctx *ctx));
|
||||
struct nvme_ns *nvme_ns, struct nvme_async_probe_ctx *ctx));
|
||||
|
||||
DEFINE_STUB_V(bdev_ocssd_depopulate_namespace, (struct nvme_bdev_ns *nvme_ns));
|
||||
DEFINE_STUB_V(bdev_ocssd_depopulate_namespace, (struct nvme_ns *nvme_ns));
|
||||
|
||||
DEFINE_STUB_V(bdev_ocssd_namespace_config_json, (struct spdk_json_write_ctx *w,
|
||||
struct nvme_bdev_ns *nvme_ns));
|
||||
struct nvme_ns *nvme_ns));
|
||||
|
||||
DEFINE_STUB(bdev_ocssd_create_io_channel, int, (struct nvme_ctrlr_channel *ioch), 0);
|
||||
|
||||
@ -2243,7 +2243,7 @@ test_bdev_unregister(void)
|
||||
struct spdk_nvme_host_id hostid = {};
|
||||
struct spdk_nvme_ctrlr *ctrlr;
|
||||
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr;
|
||||
struct nvme_bdev_ns *nvme_ns1, *nvme_ns2;
|
||||
struct nvme_ns *nvme_ns1, *nvme_ns2;
|
||||
const int STRING_SIZE = 32;
|
||||
const char *attached_names[STRING_SIZE];
|
||||
struct nvme_bdev *bdev1, *bdev2;
|
||||
|
@ -191,7 +191,7 @@ io_channel_destroy_cb(void *io_device, void *ctx_buf)
|
||||
|
||||
void
|
||||
nvme_ctrlr_populate_namespace_done(struct nvme_async_probe_ctx *ctx,
|
||||
struct nvme_bdev_ns *ns, int rc)
|
||||
struct nvme_ns *ns, int rc)
|
||||
{
|
||||
CU_ASSERT_EQUAL(rc, 0);
|
||||
ns->ctrlr->ref++;
|
||||
@ -217,7 +217,7 @@ create_nvme_bdev_controller(const struct spdk_nvme_transport_id *trid, const cha
|
||||
rc = pthread_mutex_init(&nvme_bdev_ctrlr->mutex, NULL);
|
||||
SPDK_CU_ASSERT_FATAL(rc == 0);
|
||||
|
||||
nvme_bdev_ctrlr->namespaces = calloc(ctrlr->ns_count, sizeof(struct nvme_bdev_ns *));
|
||||
nvme_bdev_ctrlr->namespaces = calloc(ctrlr->ns_count, sizeof(struct nvme_ns *));
|
||||
SPDK_CU_ASSERT_FATAL(nvme_bdev_ctrlr->namespaces != NULL);
|
||||
|
||||
trid_entry = calloc(1, sizeof(struct nvme_bdev_ctrlr_trid));
|
||||
@ -230,12 +230,12 @@ create_nvme_bdev_controller(const struct spdk_nvme_transport_id *trid, const cha
|
||||
nvme_bdev_ctrlr->connected_trid = &trid_entry->trid;
|
||||
nvme_bdev_ctrlr->name = strdup(name);
|
||||
for (nsid = 0; nsid < ctrlr->ns_count; ++nsid) {
|
||||
nvme_bdev_ctrlr->namespaces[nsid] = calloc(1, sizeof(struct nvme_bdev_ns));
|
||||
nvme_bdev_ctrlr->namespaces[nsid] = calloc(1, sizeof(struct nvme_ns));
|
||||
SPDK_CU_ASSERT_FATAL(nvme_bdev_ctrlr->namespaces[nsid] != NULL);
|
||||
|
||||
nvme_bdev_ctrlr->namespaces[nsid]->id = nsid + 1;
|
||||
nvme_bdev_ctrlr->namespaces[nsid]->ctrlr = nvme_bdev_ctrlr;
|
||||
nvme_bdev_ctrlr->namespaces[nsid]->type = NVME_BDEV_NS_OCSSD;
|
||||
nvme_bdev_ctrlr->namespaces[nsid]->type = NVME_NS_OCSSD;
|
||||
|
||||
bdev_ocssd_populate_namespace(nvme_bdev_ctrlr, nvme_bdev_ctrlr->namespaces[nsid], NULL);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user