OSDN Git Service

hw/block/nvme: support allocated namespace type
authorMinwoo Im <minwoo.im.dev@gmail.com>
Fri, 5 Feb 2021 17:15:10 +0000 (02:15 +0900)
committerKlaus Jensen <k.jensen@samsung.com>
Tue, 9 Mar 2021 10:00:58 +0000 (11:00 +0100)
commit94d8d6d1678156dfc7244beef75c05db52965d60
treec6a2c5ecd1edb56992fc664a4c36366385e03720
parent92cad003c131c1866580beb4c00e19551652be8d
hw/block/nvme: support allocated namespace type

From NVMe spec 1.4b "6.1.5. NSID and Namespace Relationships" defines
valid namespace types:

- Unallocated: Not exists in the NVMe subsystem
- Allocated: Exists in the NVMe subsystem
- Inactive: Not attached to the controller
- Active: Attached to the controller

This patch added support for allocated, but not attached namespace type:

!nvme_ns(n, nsid) && nvme_subsys_ns(n->subsys, nsid)

nvme_ns() returns attached namespace instance of the given controller
and nvme_subsys_ns() returns allocated namespace instance in the
subsystem.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Tested-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
hw/block/nvme-subsys.h
hw/block/nvme.c