Skip to contentSkip to conversation

hw/block/nvme: add missing mor/mar constraint check

PATCH Superseded Klaus Jensen 1 participant 1 message Jan 26, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/block/nvme: add missing mor/mar constraint check

From: Klaus Jensen <[email protected]>

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.

---
 hw/block/nvme-ns.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
hw/block/nvme-ns.c +6 -6
index 62b25cf69bfa..9586f7f33b8c 100644
@@ -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,
Signature · 1 line
2.30.0