diff options
| author | Minwoo Im <minwoo.im.dev@gmail.com> | 2021-01-17 23:53:34 +0900 |
|---|---|---|
| committer | Klaus Jensen <k.jensen@samsung.com> | 2021-02-08 21:15:53 +0100 |
| commit | 15d024d4aa9b73ff05604f6f6d998788d3ea26e2 (patch) | |
| tree | 0ba71ecbbe6c91d483bd672962cb361e2a531b78 /hw | |
| parent | 337ccd7650cfab379bfba9eed54ad790e88ec62e (diff) | |
| download | focaccia-qemu-15d024d4aa9b73ff05604f6f6d998788d3ea26e2.tar.gz focaccia-qemu-15d024d4aa9b73ff05604f6f6d998788d3ea26e2.zip | |
hw/block/nvme: split setup and register for namespace
In NVMe, namespace is being attached to process I/O. We register NVMe namespace to a controller via nvme_register_namespace() during nvme_ns_setup(). This is main reason of receiving NvmeCtrl object instance to this function to map the namespace to a controller. To make namespace instance more independent, it should be split into two parts: setup and register. This patch split them into two differnt parts, and finally nvme_ns_setup() does not have nothing to do with NvmeCtrl instance at all. This patch is a former patch to introduce NVMe subsystem scheme to the existing design especially for multi-path. In that case, it should be split into two to make namespace independent from a controller. Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Diffstat (limited to 'hw')
| -rw-r--r-- | hw/block/nvme-ns.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/hw/block/nvme-ns.c b/hw/block/nvme-ns.c index 17e876e6bc..ce79ad4a53 100644 --- a/hw/block/nvme-ns.c +++ b/hw/block/nvme-ns.c @@ -321,10 +321,6 @@ int nvme_ns_setup(NvmeCtrl *n, NvmeNamespace *ns, Error **errp) nvme_ns_init_zoned(ns, 0); } - if (nvme_register_namespace(n, ns, errp)) { - return -1; - } - return 0; } @@ -362,6 +358,13 @@ static void nvme_ns_realize(DeviceState *dev, Error **errp) "could not setup namespace: "); return; } + + if (nvme_register_namespace(n, ns, errp)) { + error_propagate_prepend(errp, local_err, + "could not register namespace: "); + return; + } + } static Property nvme_ns_props[] = { |