nvme: continue initialization even if NN=0
Similar to the previous patch, some controllers may report 0 namespaces; we should still be able to send admin commands in this situation. Change-Id: Ia14e3ce773c63e645199e1c40ba5b37095da2473 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/407497 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
c9ef7642c9
commit
453c804d1b
@ -1098,17 +1098,17 @@ nvme_ctrlr_construct_namespaces(struct spdk_nvme_ctrlr *ctrlr)
|
|||||||
uint32_t i, nn = ctrlr->cdata.nn;
|
uint32_t i, nn = ctrlr->cdata.nn;
|
||||||
uint64_t phys_addr = 0;
|
uint64_t phys_addr = 0;
|
||||||
|
|
||||||
if (nn == 0) {
|
|
||||||
SPDK_ERRLOG("controller has 0 namespaces\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ctrlr->num_ns may be 0 (startup) or a different number of namespaces (reset),
|
/* ctrlr->num_ns may be 0 (startup) or a different number of namespaces (reset),
|
||||||
* so check if we need to reallocate.
|
* so check if we need to reallocate.
|
||||||
*/
|
*/
|
||||||
if (nn != ctrlr->num_ns) {
|
if (nn != ctrlr->num_ns) {
|
||||||
nvme_ctrlr_destruct_namespaces(ctrlr);
|
nvme_ctrlr_destruct_namespaces(ctrlr);
|
||||||
|
|
||||||
|
if (nn == 0) {
|
||||||
|
SPDK_WARNLOG("controller has 0 namespaces\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ctrlr->ns = spdk_dma_zmalloc(nn * sizeof(struct spdk_nvme_ns), 64,
|
ctrlr->ns = spdk_dma_zmalloc(nn * sizeof(struct spdk_nvme_ns), 64,
|
||||||
&phys_addr);
|
&phys_addr);
|
||||||
if (ctrlr->ns == NULL) {
|
if (ctrlr->ns == NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user