hw/block/nvme: update nsid when registered
PATCH 1/1 hw/block/nvme: update nsid when registered
From: Klaus Jensen <[email protected]>
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.
--- hw/block/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/block/nvme.c +1 -1
@@ -2583,7 +2583,7 @@ int nvme_register_namespace(NvmeCtrl *n, NvmeNamespace *ns, Error **errp)for (int i =1 ; i <= n->num_namespaces; i++) {NvmeNamespace *ns =nvme_ns (n, i);if (!ns) { - nsid = i; + nsid = ns->params.nsid = i;break ; } }
Signature · 1 line
2.28.0
Quoted 13 lines
-----Original Message-----
From: Qemu-devel <qemu-devel- [email protected]> On Behalf Of Klaus Jensen
Sent: Thursday, October 1, 2020 5:51 PM
To: [email protected]
Cc: Kevin Wolf <[email protected]>; [email protected]; Klaus Jensen <[email protected]>; Max Reitz <[email protected]>; Klaus Jensen <[email protected]>; Keith Busch <[email protected]>
Subject: [PATCH] hw/block/nvme: update nsid when registeredFrom: Klaus Jensen <[email protected]>
Quoted 7 lines
If the user does not specify an nsid parameter on the nvme-ns device,
nvme_register_namespacewill find the first free namespace id and assign that.This fix makes sure the assigned id is saved.
Signed-off-by Klaus Jensen <[email protected]>
Yep, this makes autogenerated NSIDs work.
Quoted 21 lines
--- hw/block/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/block/nvme.c +1
-1@@ -2583,7 +2583,7 @@ int nvme_register_namespace(NvmeCtrl *n, NvmeNamespace *ns, Error **errp)for (int i =1 ; i <= n->num_namespaces; i++) {NvmeNamespace *ns =nvme_ns (n, i);if (!ns) { - nsid = i; + nsid = ns->params.nsid = i;break ; }}--
2.28.0
Klaus Jensen
AppliedQuoted 30 lines · Klaus Jensen
From: Klaus Jensen <[email protected]>
If the user does not specify an nsid parameter on the nvme-ns device,
nvme_register_namespacewill find the first free namespace id and assign that.This fix makes sure the assigned id is saved.
Signed-off-by Klaus Jensen <[email protected]>--- hw/block/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/block/nvme.c +1
-1@@ -2583,7 +2583,7 @@ int nvme_register_namespace(NvmeCtrl *n, NvmeNamespace *ns, Error **errp)for (int i =1 ; i <= n->num_namespaces; i++) {NvmeNamespace *ns =nvme_ns (n, i);if (!ns) { - nsid = i; + nsid = ns->params.nsid = i;break ; } }Signature · 1 line
2.28.0
Applied to nvme-next.