nvme: Add a new option disable_read_ana_log_page to struct spdk_nvme_ctrlr_opts

NVMe bdev module manages ANA log page itself now. So NVMe driver
should disable managing ANA log page.

Add a new option disable_read_ana_log_page to struct spdk_nvme_ctrlr_opts.
Then NVMe bdev module enables it when calling spdk_nvme_connect_async().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id5249efe90a4d50763c3a7eaa1eb9572f60fbc8c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8313
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Shuhei Matsumoto 2021-07-08 00:27:55 +09:00 committed by Tomasz Zawadzki
parent a066f0c3fb
commit e0715c2a6b
5 changed files with 31 additions and 10 deletions

View File

@ -83,6 +83,10 @@ Rename a variable in the member `cmic` of the struct `spdk_nvme_ctrlr_data` from
more controllers if set to 1. However `multi_host` had indicated a particular use case more controllers if set to 1. However `multi_host` had indicated a particular use case
such that the NVM subsystem is used by multiple hosts. such that the NVM subsystem is used by multiple hosts.
A new option `disable_read_ana_log_page` was added to struct `spdk_nvme_ctrlr_opts` to disable
reading ANA log page. The upper layer is expected to read ANA log page instead if `true`.
The default value is `false`.
### rpc ### rpc
New RPC `bdev_rbd_register_cluster` and `bdev_rbd_unregister_cluster` was added, it allows to create New RPC `bdev_rbd_register_cluster` and `bdev_rbd_unregister_cluster` was added, it allows to create

View File

@ -256,6 +256,14 @@ struct spdk_nvme_ctrlr_opts {
* this controller in microseconds. * this controller in microseconds.
*/ */
uint64_t fabrics_connect_timeout_us; uint64_t fabrics_connect_timeout_us;
/**
* Disable reading ANA log page. The upper layer should reading ANA log page instead
* if set to true.
*
* Default is `false` (ANA log page is read).
*/
bool disable_read_ana_log_page;
}; };
/** /**

View File

@ -958,11 +958,12 @@ nvme_ctrlr_opts_init(struct spdk_nvme_ctrlr_opts *opts,
SET_FIELD(transport_ack_timeout); SET_FIELD(transport_ack_timeout);
SET_FIELD(admin_queue_size); SET_FIELD(admin_queue_size);
SET_FIELD(fabrics_connect_timeout_us); SET_FIELD(fabrics_connect_timeout_us);
SET_FIELD(disable_read_ana_log_page);
/* Do not remove this statement. When you add a new field, please do update this /* Do not remove this statement. When you add a new field, please do update this
* assert with the correct size. And do not forget to add a new SET_FIELD statement * assert with the correct size. And do not forget to add a new SET_FIELD statement
* related with your new added field. */ * related with your new added field. */
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_ctrlr_opts) == 608, "Incorrect size"); SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_ctrlr_opts) == 616, "Incorrect size");
#undef FIELD_OK #undef FIELD_OK
#undef SET_FIELD #undef SET_FIELD

View File

@ -206,6 +206,7 @@ spdk_nvme_ctrlr_get_default_ctrlr_opts(struct spdk_nvme_ctrlr_opts *opts, size_t
SET_FIELD(transport_ack_timeout, SPDK_NVME_DEFAULT_TRANSPORT_ACK_TIMEOUT); SET_FIELD(transport_ack_timeout, SPDK_NVME_DEFAULT_TRANSPORT_ACK_TIMEOUT);
SET_FIELD(admin_queue_size, DEFAULT_ADMIN_QUEUE_SIZE); SET_FIELD(admin_queue_size, DEFAULT_ADMIN_QUEUE_SIZE);
SET_FIELD(fabrics_connect_timeout_us, NVME_FABRIC_CONNECT_COMMAND_TIMEOUT); SET_FIELD(fabrics_connect_timeout_us, NVME_FABRIC_CONNECT_COMMAND_TIMEOUT);
SET_FIELD(disable_read_ana_log_page, false);
#undef FIELD_OK #undef FIELD_OK
#undef SET_FIELD #undef SET_FIELD
@ -722,7 +723,6 @@ nvme_ctrlr_init_ana_log_page(struct spdk_nvme_ctrlr *ctrlr)
} }
ctrlr->ana_log_page_size = ana_log_page_size; ctrlr->ana_log_page_size = ana_log_page_size;
ctrlr->log_page_supported[SPDK_NVME_LOG_ASYMMETRIC_NAMESPACE_ACCESS] = true;
return nvme_ctrlr_update_ana_log_page(ctrlr); return nvme_ctrlr_update_ana_log_page(ctrlr);
} }
@ -806,12 +806,15 @@ nvme_ctrlr_set_supported_log_pages(struct spdk_nvme_ctrlr *ctrlr)
} }
} }
if (ctrlr->cdata.cmic.ana_reporting) { if (ctrlr->cdata.cmic.ana_reporting) {
ctrlr->log_page_supported[SPDK_NVME_LOG_ASYMMETRIC_NAMESPACE_ACCESS] = true;
if (!ctrlr->opts.disable_read_ana_log_page) {
rc = nvme_ctrlr_init_ana_log_page(ctrlr); rc = nvme_ctrlr_init_ana_log_page(ctrlr);
if (rc == 0) { if (rc == 0) {
nvme_ctrlr_parse_ana_log_page(ctrlr, nvme_ctrlr_update_ns_ana_states, nvme_ctrlr_parse_ana_log_page(ctrlr, nvme_ctrlr_update_ns_ana_states,
ctrlr); ctrlr);
} }
} }
}
out: out:
return rc; return rc;
@ -2699,11 +2702,14 @@ nvme_ctrlr_process_async_event(struct spdk_nvme_ctrlr *ctrlr,
if ((event.bits.async_event_type == SPDK_NVME_ASYNC_EVENT_TYPE_NOTICE) && if ((event.bits.async_event_type == SPDK_NVME_ASYNC_EVENT_TYPE_NOTICE) &&
(event.bits.async_event_info == SPDK_NVME_ASYNC_EVENT_ANA_CHANGE)) { (event.bits.async_event_info == SPDK_NVME_ASYNC_EVENT_ANA_CHANGE)) {
if (!ctrlr->opts.disable_read_ana_log_page) {
rc = nvme_ctrlr_update_ana_log_page(ctrlr); rc = nvme_ctrlr_update_ana_log_page(ctrlr);
if (rc) { if (rc) {
return; return;
} }
nvme_ctrlr_parse_ana_log_page(ctrlr, nvme_ctrlr_update_ns_ana_states, ctrlr); nvme_ctrlr_parse_ana_log_page(ctrlr, nvme_ctrlr_update_ns_ana_states,
ctrlr);
}
} }
active_proc = nvme_ctrlr_get_current_process(ctrlr); active_proc = nvme_ctrlr_get_current_process(ctrlr);

View File

@ -1593,6 +1593,7 @@ hotplug_probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
opts->low_priority_weight = (uint8_t)g_opts.low_priority_weight; opts->low_priority_weight = (uint8_t)g_opts.low_priority_weight;
opts->medium_priority_weight = (uint8_t)g_opts.medium_priority_weight; opts->medium_priority_weight = (uint8_t)g_opts.medium_priority_weight;
opts->high_priority_weight = (uint8_t)g_opts.high_priority_weight; opts->high_priority_weight = (uint8_t)g_opts.high_priority_weight;
opts->disable_read_ana_log_page = true;
SPDK_DEBUGLOG(bdev_nvme, "Attaching to %s\n", trid->traddr); SPDK_DEBUGLOG(bdev_nvme, "Attaching to %s\n", trid->traddr);
@ -2619,6 +2620,7 @@ bdev_nvme_create(struct spdk_nvme_transport_id *trid,
ctx->opts.transport_retry_count = g_opts.retry_count; ctx->opts.transport_retry_count = g_opts.retry_count;
ctx->opts.keep_alive_timeout_ms = g_opts.keep_alive_timeout_ms; ctx->opts.keep_alive_timeout_ms = g_opts.keep_alive_timeout_ms;
ctx->opts.disable_read_ana_log_page = true;
if (hostnqn) { if (hostnqn) {
snprintf(ctx->opts.hostnqn, sizeof(ctx->opts.hostnqn), "%s", hostnqn); snprintf(ctx->opts.hostnqn, sizeof(ctx->opts.hostnqn), "%s", hostnqn);