bdev/nvme: Improve names of fields in config file

Remove the "Nvme" from several field names. The parser
will still accept the old name for backward compatibility.

Change-Id: I6fa86ec359b23fb63960d0aa479a845b36a0977a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ben Walker 2017-04-04 11:12:40 -07:00
parent acd0b4573d
commit 15f910ece7
4 changed files with 24 additions and 11 deletions

View File

@ -99,9 +99,9 @@
# The number of attempts per I/O when an I/O fails. Do not include # The number of attempts per I/O when an I/O fails. Do not include
# this key to get the default behavior. # this key to get the default behavior.
NvmeRetryCount 4 RetryCount 4
# Timeout for each command, in seconds. If 0, don't track timeouts. # Timeout for each command, in seconds. If 0, don't track timeouts.
NvmeTimeoutValue 0 Timeout 0
# Action to take on command time out. Only valid when Timeout is greater # Action to take on command time out. Only valid when Timeout is greater
# than 0. This may be 'Reset' to reset the controller, 'Abort' to abort # than 0. This may be 'Reset' to reset the controller, 'Abort' to abort
# the command, or 'None' to just print a message but do nothing. # the command, or 'None' to just print a message but do nothing.

View File

@ -90,9 +90,9 @@
# The number of attempts per I/O when an I/O fails. Do not include # The number of attempts per I/O when an I/O fails. Do not include
# this key to get the default behavior. # this key to get the default behavior.
NvmeRetryCount 4 RetryCount 4
# Timeout for each command, in seconds. If 0, don't track timeouts. # Timeout for each command, in seconds. If 0, don't track timeouts.
NvmeTimeoutValue 0 Timeout 0
# Action to take on command time out. Only valid when Timeout is greater # Action to take on command time out. Only valid when Timeout is greater
# than 0. This may be 'Reset' to reset the controller, 'Abort' to abort # than 0. This may be 'Reset' to reset the controller, 'Abort' to abort
# the command, or 'None' to just print a message but do nothing. # the command, or 'None' to just print a message but do nothing.

View File

@ -78,9 +78,9 @@
# The number of attempts per I/O when an I/O fails. Do not include # The number of attempts per I/O when an I/O fails. Do not include
# this key to get the default behavior. # this key to get the default behavior.
NvmeRetryCount 4 RetryCount 4
# Timeout for each command, in seconds. If 0, don't track timeouts. # Timeout for each command, in seconds. If 0, don't track timeouts.
NvmeTimeoutValue 0 Timeout 0
# Action to take on command time out. Only valid when Timeout is greater # Action to take on command time out. Only valid when Timeout is greater
# than 0. This may be 'Reset' to reset the controller, 'Abort' to abort # than 0. This may be 'Reset' to reset the controller, 'Abort' to abort
# the command, or 'None' to just print a message but do nothing. # the command, or 'None' to just print a message but do nothing.

View File

@ -768,17 +768,24 @@ bdev_nvme_library_init(void)
int rc; int rc;
size_t i; size_t i;
struct nvme_probe_ctx probe_ctx = {}; struct nvme_probe_ctx probe_ctx = {};
int retry_count;
sp = spdk_conf_find_section(NULL, "Nvme"); sp = spdk_conf_find_section(NULL, "Nvme");
if (sp == NULL) { if (sp == NULL) {
return 0; return 0;
} }
spdk_nvme_retry_count = spdk_conf_section_get_intval(sp, "NvmeRetryCount"); if ((retry_count = spdk_conf_section_get_intval(sp, "RetryCount")) < 0) {
if (spdk_nvme_retry_count < 0) { if ((retry_count = spdk_conf_section_get_intval(sp, "NvmeRetryCount")) < 0) {
spdk_nvme_retry_count = SPDK_NVME_DEFAULT_RETRY_COUNT; retry_count = SPDK_NVME_DEFAULT_RETRY_COUNT;
} else {
SPDK_WARNLOG("NvmeRetryCount was renamed to RetryCount\n");
SPDK_WARNLOG("Please update your configuration file");
}
} }
spdk_nvme_retry_count = retry_count;
for (i = 0; i < NVME_MAX_CONTROLLERS; i++) { for (i = 0; i < NVME_MAX_CONTROLLERS; i++) {
val = spdk_conf_section_get_nmval(sp, "TransportID", i, 0); val = spdk_conf_section_get_nmval(sp, "TransportID", i, 0);
if (val == NULL) { if (val == NULL) {
@ -802,8 +809,14 @@ bdev_nvme_library_init(void)
probe_ctx.count++; probe_ctx.count++;
} }
if ((g_timeout = spdk_conf_section_get_intval(sp, "NvmeTimeoutValue")) < 0) { if ((g_timeout = spdk_conf_section_get_intval(sp, "Timeout")) < 0) {
g_timeout = 0; /* Check old name for backward compatibility */
if ((g_timeout = spdk_conf_section_get_intval(sp, "NvmeTimeoutValue")) < 0) {
g_timeout = 0;
} else {
SPDK_WARNLOG("NvmeTimeoutValue was renamed to Timeout\n");
SPDK_WARNLOG("Please update your configuration file\n");
}
} }
if (g_timeout > 0) { if (g_timeout > 0) {