]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
zns: Add printing Zone Capacity Changed from zone reset
authorSteven Seungcheol Lee <sc108.lee@samsung.com>
Fri, 10 Dec 2021 11:39:40 +0000 (20:39 +0900)
committerDaniel Wagner <dwagner@suse.de>
Fri, 10 Dec 2021 14:53:48 +0000 (15:53 +0100)
if the Variable Zone Capacity bit is set to ‘1’ in the Zone Operation
Characteristics field in the Zoned Namespace Command Set specific
Identify Namespace data structure, then the zone capacity may change
upon successful completion of a Zone Management Send command
specifying the Zone Send Action of Reset Zone

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
plugins/zns/zns.c

index 2aa98feb79815327ac4d5b0de105cd4d25ca84a4..e5797f1b56cec5f51cf53471830b7716c904b5e6 100644 (file)
@@ -234,6 +234,7 @@ static int zns_mgmt_send(int argc, char **argv, struct command *cmd, struct plug
 
        int err, fd;
        char *command;
+       __u32 result;
 
        struct config {
                __u64   zslba;
@@ -269,11 +270,16 @@ static int zns_mgmt_send(int argc, char **argv, struct command *cmd, struct plug
        }
 
        err = nvme_zns_mgmt_send(fd, cfg.namespace_id, cfg.zslba, zsa,
-               cfg.select_all, 0, 0, NULL, cfg.timeout, NULL);
-       if (!err)
+               cfg.select_all, 0, 0, NULL, cfg.timeout, &result);
+       if (!err) {
                printf("%s: Success, action:%d zone:%"PRIx64" all:%d nsid:%d\n",
                        command, zsa, (uint64_t)cfg.zslba, (int)cfg.select_all,
                        cfg.namespace_id);
+               if(result && zsa == NVME_ZNS_ZSA_RESET) {
+                       if(result & 0x1)
+                               printf("Zone Capacity has Changed by the command\n");
+               }
+       }
        else if (err > 0)
                nvme_show_status(err);
        else