hw/nvme: store a pointer to the NvmeSubsystem in the NvmeNamespace

Each NvmeNamespace can be used by serveral controllers,
but a NvmeNamespace can at most belong to a single NvmeSubsystem.
Store a pointer to the NvmeSubsystem, if the namespace was realized
with a NvmeSubsystem.

Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
This commit is contained in:
Niklas Cassel 2023-02-20 12:59:23 +01:00 committed by Klaus Jensen
parent a555af1707
commit 534a93d3a0
2 changed files with 2 additions and 0 deletions

View File

@ -561,6 +561,7 @@ static void nvme_ns_realize(DeviceState *dev, Error **errp)
if (!qdev_set_parent_bus(dev, &subsys->bus.parent_bus, errp)) {
return;
}
ns->subsys = subsys;
}
if (nvme_ns_setup(ns, errp)) {

View File

@ -167,6 +167,7 @@ typedef struct NvmeNamespace {
int32_t nr_active_zones;
NvmeNamespaceParams params;
NvmeSubsystem *subsys;
struct {
uint32_t err_rec;