All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hw/block/nvme: add missing mor/mar constraint check
@ 2021-01-26 11:46 Klaus Jensen
  0 siblings, 0 replies; only message in thread
From: Klaus Jensen @ 2021-01-26 11:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, qemu-block, Dmitry Fomichev, Klaus Jensen,
	Gollu Appalanaidu, Max Reitz, Keith Busch, Klaus Jensen

From: Klaus Jensen <k.jensen@samsung.com>

The Maximum Open Resources field shall be less than or equal to the
Maximum Active Resources field.

Verify that constraint and remove the redundant check that the Maximum
Open Resources field does not exceed the number of zones.

Cc: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Reported-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
---
 hw/block/nvme-ns.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/block/nvme-ns.c b/hw/block/nvme-ns.c
index 62b25cf69bfa..9586f7f33b8c 100644
--- a/hw/block/nvme-ns.c
+++ b/hw/block/nvme-ns.c
@@ -140,12 +140,6 @@ static int nvme_ns_zoned_check_calc_geometry(NvmeNamespace *ns, Error **errp)
         return -1;
     }
 
-    if (ns->params.max_open_zones > ns->num_zones) {
-        error_setg(errp,
-                   "max_open_zones value %u exceeds the number of zones %u",
-                   ns->params.max_open_zones, ns->num_zones);
-        return -1;
-    }
     if (ns->params.max_active_zones > ns->num_zones) {
         error_setg(errp,
                    "max_active_zones value %u exceeds the number of zones %u",
@@ -153,6 +147,12 @@ static int nvme_ns_zoned_check_calc_geometry(NvmeNamespace *ns, Error **errp)
         return -1;
     }
 
+    if (ns->params.max_open_zones > ns->params.max_active_zones) {
+        error_setg(errp, "max_open_zones (%u) exceeds max_active_zones (%u)",
+                   ns->params.max_open_zones, ns->params.max_active_zones);
+        return -1;
+    }
+
     if (ns->params.zd_extension_size) {
         if (ns->params.zd_extension_size & 0x3f) {
             error_setg(errp,
-- 
2.30.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-26 11:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-26 11:46 [PATCH] hw/block/nvme: add missing mor/mar constraint check Klaus Jensen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.