hw/nvme: change nvme-ns 'shared' default
Change namespaces to be shared namespaces by default (parameter shared=on). Keep shared=off for older machine types. Reviewed-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
This commit is contained in:
parent
9fc6e86e8b
commit
916b0f0b52
@ -110,28 +110,32 @@ multipath I/O.
|
|||||||
This will create an NVM subsystem with two controllers. Having controllers
|
This will create an NVM subsystem with two controllers. Having controllers
|
||||||
linked to an ``nvme-subsys`` device allows additional ``nvme-ns`` parameters:
|
linked to an ``nvme-subsys`` device allows additional ``nvme-ns`` parameters:
|
||||||
|
|
||||||
``shared`` (default: ``off``)
|
``shared`` (default: ``on`` since 6.2)
|
||||||
Specifies that the namespace will be attached to all controllers in the
|
Specifies that the namespace will be attached to all controllers in the
|
||||||
subsystem. If set to ``off`` (the default), the namespace will remain a
|
subsystem. If set to ``off``, the namespace will remain a private namespace
|
||||||
private namespace and may only be attached to a single controller at a time.
|
and may only be attached to a single controller at a time. Shared namespaces
|
||||||
|
are always automatically attached to all controllers (also when controllers
|
||||||
|
are hotplugged).
|
||||||
|
|
||||||
``detached`` (default: ``off``)
|
``detached`` (default: ``off``)
|
||||||
If set to ``on``, the namespace will be be available in the subsystem, but
|
If set to ``on``, the namespace will be be available in the subsystem, but
|
||||||
not attached to any controllers initially.
|
not attached to any controllers initially. A shared namespace with this set
|
||||||
|
to ``on`` will never be automatically attached to controllers.
|
||||||
|
|
||||||
Thus, adding
|
Thus, adding
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
-drive file=nvm-1.img,if=none,id=nvm-1
|
-drive file=nvm-1.img,if=none,id=nvm-1
|
||||||
-device nvme-ns,drive=nvm-1,nsid=1,shared=on
|
-device nvme-ns,drive=nvm-1,nsid=1
|
||||||
-drive file=nvm-2.img,if=none,id=nvm-2
|
-drive file=nvm-2.img,if=none,id=nvm-2
|
||||||
-device nvme-ns,drive=nvm-2,nsid=3,detached=on
|
-device nvme-ns,drive=nvm-2,nsid=3,shared=off,detached=on
|
||||||
|
|
||||||
will cause NSID 1 will be a shared namespace (due to ``shared=on``) that is
|
will cause NSID 1 will be a shared namespace that is initially attached to both
|
||||||
initially attached to both controllers. NSID 3 will be a private namespace
|
controllers. NSID 3 will be a private namespace due to ``shared=off`` and only
|
||||||
(i.e. only attachable to a single controller at a time) and will not be
|
attachable to a single controller at a time. Additionally it will not be
|
||||||
attached to any controller initially (due to ``detached=on``).
|
attached to any controller initially (due to ``detached=on``) or to hotplugged
|
||||||
|
controllers.
|
||||||
|
|
||||||
Optional Features
|
Optional Features
|
||||||
=================
|
=================
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
GlobalProperty hw_compat_6_1[] = {
|
GlobalProperty hw_compat_6_1[] = {
|
||||||
{ "vhost-user-vsock-device", "seqpacket", "off" },
|
{ "vhost-user-vsock-device", "seqpacket", "off" },
|
||||||
|
{ "nvme-ns", "shared", "off" },
|
||||||
};
|
};
|
||||||
const size_t hw_compat_6_1_len = G_N_ELEMENTS(hw_compat_6_1);
|
const size_t hw_compat_6_1_len = G_N_ELEMENTS(hw_compat_6_1);
|
||||||
|
|
||||||
|
@ -465,12 +465,6 @@ static void nvme_ns_realize(DeviceState *dev, Error **errp)
|
|||||||
"linked to an nvme-subsys device");
|
"linked to an nvme-subsys device");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ns->params.shared) {
|
|
||||||
error_setg(errp, "shared requires that the nvme device is "
|
|
||||||
"linked to an nvme-subsys device");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* If this namespace belongs to a subsystem (through a link on the
|
* If this namespace belongs to a subsystem (through a link on the
|
||||||
@ -532,7 +526,7 @@ static void nvme_ns_realize(DeviceState *dev, Error **errp)
|
|||||||
static Property nvme_ns_props[] = {
|
static Property nvme_ns_props[] = {
|
||||||
DEFINE_BLOCK_PROPERTIES(NvmeNamespace, blkconf),
|
DEFINE_BLOCK_PROPERTIES(NvmeNamespace, blkconf),
|
||||||
DEFINE_PROP_BOOL("detached", NvmeNamespace, params.detached, false),
|
DEFINE_PROP_BOOL("detached", NvmeNamespace, params.detached, false),
|
||||||
DEFINE_PROP_BOOL("shared", NvmeNamespace, params.shared, false),
|
DEFINE_PROP_BOOL("shared", NvmeNamespace, params.shared, true),
|
||||||
DEFINE_PROP_UINT32("nsid", NvmeNamespace, params.nsid, 0),
|
DEFINE_PROP_UINT32("nsid", NvmeNamespace, params.nsid, 0),
|
||||||
DEFINE_PROP_UUID("uuid", NvmeNamespace, params.uuid),
|
DEFINE_PROP_UUID("uuid", NvmeNamespace, params.uuid),
|
||||||
DEFINE_PROP_UINT64("eui64", NvmeNamespace, params.eui64, 0),
|
DEFINE_PROP_UINT64("eui64", NvmeNamespace, params.eui64, 0),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user