mirror of https://gitee.com/openkylin/qemu.git
hw/block/nvme: update nsid when registered
If the user does not specify an nsid parameter on the nvme-ns device, nvme_register_namespace will find the first free namespace id and assign that. This fix makes sure the assigned id is saved. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
This commit is contained in:
parent
6eb7a07129
commit
b20804946b
|
@ -2578,7 +2578,7 @@ int nvme_register_namespace(NvmeCtrl *n, NvmeNamespace *ns, Error **errp)
|
||||||
for (int i = 1; i <= n->num_namespaces; i++) {
|
for (int i = 1; i <= n->num_namespaces; i++) {
|
||||||
NvmeNamespace *ns = nvme_ns(n, i);
|
NvmeNamespace *ns = nvme_ns(n, i);
|
||||||
if (!ns) {
|
if (!ns) {
|
||||||
nsid = i;
|
nsid = ns->params.nsid = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue